I'm loading a Lua script to be run multiple times and another Lua script that acts as a library that is supposed to be used by the first script.
Let HelloWorldAPI.lua :
function HelloWorld()
return "Hello world"
end
And SomeScript.lua :
HelloWorld()
I'm doing things in the following order :
L = luaL_newstate();
luaL_openlibs( L );
luaL_loadfile( L, "HelloWorldAPI.lua" );
luaL_loadfile( L, "SomeScript.lua" );
...
lua_pcall( L, 0, 0, 0 )
...
lua_pcall( L, 0, 0, 0 )
...
(some pieces of code were removed to keep it simple)
But I'm geting an error saying that I'm trying to call a nil value when calling the HelloWorld function.
Why ?
The function that I declared when the lib script was executed should be global and thus available in SomeScript.lua, right ?
Thank you.
C? - Shark