lua-users home
lua-l archive

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


I don't understand your question. What is SetEventFunction() ? A C function
?
In that case, as you can lua_ref func(), you can lua_ref theObject just as
well for later use.
And if SetEventFunction() is unrelated, you know there is a global named
"theObject" which is your table, and a global named "func" which is your
function, and you can use the LUA API to retrieve both by name and do
whatever you want, including lua_ref()-ing them for later use.


Cheers,

Benoit.

-----Message d'origine-----
De : jose_marin2 <jose_marin2@yahoo.com.br>
[mailto:jose_marin2@yahoo.com.br]
Envoyé : mercredi 22 janvier 2003 15:33
À : Multiple recipients of list
Objet : How to pass a table as a parameter?


Hello!

Im trying to do this:

in Lua:

-----------

function CreateObject()
local Object = {}

function Object:DoSomething()
...
end

return Object

end

function func(obj)

obj:DoSomething()

end

theObject = CreateObject()

SetEventFunction(theObject, func)

-----------

In C, I must call "func", passing as parameter the table 
("theObject").

I know how to get the address and call func(via lua_getref), but how 
to get the address of a table, and pass it to the function call?