lua-users home
lua-l archive

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

well, since you ref'ed everything, when the event is received, just:

// push lua function on the stack
lua_getref(L,<ref to your function>);
// push table on the stack
lua_getref(L,<ref to a suitable table>);
// protected call of the function with 1 argument on the stack and 0 return
values, and no error handler
status = lua_pcall(L,1,0,0);

> -----Message d'origine-----
> De : jose_marin2 <>
> []
> Envoyé : mercredi 22 janvier 2003 20:04
> À : Multiple recipients of list
> Objet : Re: How to pass a table as a parameter?
> SetEventFunction is a C function. Something like a SetKeyFunction ou 
> SetMouseFunction. It must take the 2 parameters (a table and a 
> function), save them and call the function with tha table as a 
> parameters when an event (key pressing, for example) occurs.
> I know how take the addresses of the table and the function (via 
> lua_ref), but still don't know how to call the function, passing the 
> table as a parameter. Like this: function(table)
> the function will be used by several tables, thats why I must pass 
> the correct table as a parameter.