I have a big object constructed from C++ (that I have exposed to Lua) and I want to be processed in Lua.
I can pass any simple type to a Lua function (int
, string
) using lua_pushinteger
, lua_pushstring
but not a C++ class. I have tried lua_pushlightuserdata
by pushing a pointer to my object but no luck.
function process(object) --object is the c++ passed function
--return processed data
end
How can I do that? Is that even possible?
Please note that I want to pass to Lua a specific instance constructed in C++. I can expose the constructor and simply use class but I will need to make the class a singleton. This is not acceptable.