|
Am 08.12.2012 um 22:17 schrieb Kevin Martin:
okay I have found my error: luaL_newlib( m_lua, &l_functions[0] ); lua_setglobal( m_lua, "pre.sub" ); so I have implementated a splitting of the string and a recursiv lua_newtable & lua_setfield creation: void pushTable( packagename, isfirst, islast, luaL_Reg* ptr ) { if !islast { if !isfirst lua_newtable(L) pushTable( next(packagename), current_package_isfirst, next_package_islast(packagename), ptr) if !isfirst lua_setfield(L) } else lua_newlib( L, ptr ) if isfirst lua_setglobal( L, packagename ) } How I can search if a table exists eg I call the function like pushTable( ["first", "second", "third"], true, false, ptr1 ) pushTable( ["first", "second", "forth"], true, false, ptr2 ) In this case the second table must be append with the data, how can I check if the table exists and append a dataset? Thanks Phil |