I'm writing an alternative Blitz Lua module at the moment, this is a bit from it that should help you out. It passes the Blitz object as a Lua variable of type "light userdata", which is basically like a "Byte Ptr" or "void *".
Warning: It's your responsibility to make sure that this pointer is still pointing to something later on when you want to pop it back out using lua_toblitzobject, since Blitz's garbage collector will not know that a reference exists inside Lua and will happily collect the object if no reference exists in your Blitz program. (I've got a plan to stop this & have objects which will not be collected until both the Blitz *and* Lua garbage collectors want rid of it, but I haven't put it into action yet.) So you will still need those arrays of all your objects, even if you don't appear to actually be using them.
Extern
Function lua_pushblitzobject( lua_state:Byte Ptr, blitzobject:Object )="lua_pushlightuserdata"
Function lua_toblitzobject:Object( lua_state:Byte Ptr, index:Int )="lua_touserdata"
End Extern
|