I'm a beginner to Lua, and I'm trying to make my way around it. Am I right in thinking that "light userdata" is a good way to allow Lua to refer to Blitz objects? I think I've worked out how to send a pointer to an object *in* to Lua:
...And use lua_register to allow this function to be called from Lua. Which is fine. But how do I send the light userdata from Lua back out to another Blitz function, and have it turn back into a valid Blitz object? There doesn't seem to be any way. I'd greatly appreciate any help on this.
Function GetAMyType:Int(_st:Byte Ptr) Local mt:MyType = New MyType mt.text = "Hello world!" lua_pushlightuserdata(_st, Byte Ptr(mt)) Return 1 End Function
...And use lua_register to allow this function to be called from Lua. Which is fine. But how do I send the light userdata from Lua back out to another Blitz function, and have it turn back into a valid Blitz object? There doesn't seem to be any way. I'd greatly appreciate any help on this.