lua-users home
lua-l archive

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


Hi,

it's even simpler ... you just have to do

lua_getref(l, func)
lua_getref(l, tab)
lua_call(l, 1)

the func and paramter will be removed from the stack by lua_call

  Michael


> -----Ursprüngliche Nachricht-----
> Von: owner-lua-l@tecgraf.puc-rio.br 
> [mailto:owner-lua-l@tecgraf.puc-rio.br] Im Auftrag von 
> jose_marin2 <jose_marin2@yahoo.com.br>
> Gesendet: Mittwoch, 22. Januar 2003 21:02
> An: Multiple recipients of list
> Betreff: How to push a table in the stack?
> 
> 
> Hi, again.
> 
> All I nedd to know is how to push a table in the stack.
> For example, I have the functions lua_pushnumber, 
> lua_pushstring, etc. How to make a "lua_pushtable"?
> 
> I have the address of the table(via lua_ref) and will use the 
> lus_pushtable to put the table as a parameter.
> 
> int _table, _func;
> 
> int l_setevent(lua_State* L){
> 
> 	_table = lua_ref(L, 1);
> 	_func = lua_ref(L, 2);
> ...
> }
> 
> Then, to call the function
> 
> lua_getref(L, _func);
> 			
> lua_pushtable(L, _table);
>        
> lua_call(L, 1);
> 
> lua_pop(L);
> 
> Is that possible?
>