[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: executing functions from file, without using luaL_dofile
- From: jseb <gmane2010@...>
- Date: Sun, 01 May 2011 17:54:19 +0200
Hello,
I'm trying to load a Lua script from a C file, without executing it at
load time.
In other words, i don't want to use "luaL_dofile (L, script.lua)".
So i use instead "luaL_loadfile (L, "script.lua") "
But after loading the script file, how can i execute "foo" function from
inside it ?
i tried this:
lua_getglobal(L, "foo");
lua_pcall (L,0,0,0); //compile function
lua_getfield (L, LUA_GLOBALSINDEX,"foo");
lua_pcall (L, 0,0,0); //execute function
but the function is not executed.
Thank you.