|
On 2012-12-08 14:25:27 +0100, liam mail said:
On 8 December 2012 12:28, Philipp Kraus <philipp.kraus@flashpixx.de> wrote:Am 08.12.2012 um 11:40 schrieb Luiz Henrique de Figueiredo:luaL_register(L,"org.conman.math",reg_math); Never had a problem.This no longer works is 5.2 because in 5.1 luaL_register called (the undocumented and badly named) luaL_findtable which did that magic, but 5.2 lacks luaL_findtable. If you want to keep this way of registering your libraries is 5.2, but don't want to use or require LUA_COMPAT_MODULE when build Lua, you can copy luaL_findtable from the 5.2 source and use this version of luaL_register: void luaL_register(lua_State *L, const char *libname, const luaL_Reg *l) { lua_pushglobaltable(L); luaL_findtable(L,-1,libname,0); luaL_setfuncs(L,l,0); }The findtable call does not exists. I have include the files #include <lua.h> #include <lauxlib.h> #include <lualib.h> Do I have forgot an include? I'm using Lua 5.2.1 Thanks PhilIf you want to keep this way of registering your libraries is 5.2, but don't want to use or require LUA_COMPAT_MODULE when build Lua, you can copy luaL_findtable from the 5.2 source and use this version of luaL_register:
Can you send me a working example for 5.2? I try to push a table with function pointer
to call them in my script. I try to create this: lua_newtable(m_lua); luaL_setfuncs( m_lua, &l_functions[0], 0); lua_pushvalue(m_lua, -1); lua_setglobal(m_lua, p_libname.c_str());but in my script I can not call any of my functions (they don't exist). I would like to put
a set of "global functions" to the script. Thanks Phil