[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: What is the problem with luaL_dofile
- From: "Joseph C. Sible" <josephcsible@...>
- Date: Sun, 8 Aug 2021 12:49:09 -0400
Per the reference manual, calling luaL_dofile is equivalent to calling
luaL_loadfile, and if it succeeds, then also calling lua_pcall. Both
of those functions push an error onto the stack if they fail. Check
the value on the top of the stack.
Joseph C. Sible
On Sun, Aug 8, 2021 at 12:30 PM Peter Hickman
<peterhickman386@googlemail.com> wrote:
>
> I am running the following C snippet and it works fine on Darwin but on Linux the else is called. I have run "lua5.3 here/boot.lua" and it runs just fine. But calling it from C fails. How can I find out what the problem was? Is there a "last_error" I could check?
>
> if (luaL_dofile(L, "here/boot.lua") == LUA_OK) {
> lua_pop(L, lua_gettop(L));
> } else {
> puts("Failed to run the script!");
> }
>
>