lua-users home
lua-l archive

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


So like this:

lua_pushcfunction(L, luaopen_io);
lua_getfield(L, LUA_GLOBALSINDEX, "luaopen_io");
lua_call(L, 0, 0);

That gives me the same PANIC... :-/

Thomas Harning Jr. wrote:
luaopen_io is a function that should be called from within Lua.....
if thats the best way to term it..

Proper code...
lua_State* L = luaL_newstate(); /* lua_open is a compatbility macro to
point to luaL_newstate, which configures malloc/realloc/free as memory
functions.. */
lua_pushcfunction(L, luaopen_io);
lua_call(L, 0, 0);

...