lua-users home
lua-l archive

Re: cloning lua state

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


Am 07.10.2014 um 20:10 schrieb Sean Conner <sean@conman.org>:
> It was thus said that the Great Philipp Kraus once stated:
>> Hello,
>> 
>> thanks for this code excerpt. 
>> 
>> 
>> Am 07.10.2014 um 13:05 schrieb Udo Schroeter <udo.schroeter@gmail.com>:
>> 
>>> luaL_checktype(L, 1, LUA_TFUNCTION);
>>> lua_settop(L, 1);
>> 
>> I would like to dump all script functions. Can I iterate over all script function and
>> push the functions on the stack top and run after this the dump?
> 
> You can compile Lua scripts using "luac". The output will be Lua
> bytecode, which can then be loaded using the same functions that you use to
> load regular Lua scripts.
Sorry for my bad description, my Lua script ist added by the user, so I have got a script
with a lot of global functions, so on the dump process, I need to get all non-default functions.
I must do something like:
std::vector< std::string > function = lua_getglobalfunction();
for(std::size_t i=0; i < function.size(); ++i
{
 lua_getglobal( L, function[i].c_str() );
 lua_dump
}
Thanks
Phil

AltStyle によって変換されたページ (->オリジナル) /