lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Mon, Mar 28, 2011 at 11:27, Anthony Howe <achowe+lua@snert.com> wrote:
> Lua 5.1.4
>
> I use luaL_loadbuffer() to push a chunk of code on the stack, which in turn uses lua_load. lua_load states
>
>        If there are no errors, lua_load pushes the compiled chunk as
>        a Lua _function_ on top of the stack.
>
> If the top of the stack is a function then why does
>
>        rc = lua_resume(L, 0);
>
> fail? I should be able to execute a chunk of Lua code in a thread using resume?
>
> --
> Anthony C Howe            Skype: SirWumpus                  SnertSoft
>                        Twitter: SirWumpus      BarricadeMX & Milters
> http://snert.com/      http://nanozen.info/     http://snertsoft.com/
>
>

lua_resume is for running coroutines. You want lua_call or lua_pcall
for calling a function.

-- 
Sent from my toaster.