Passing a Table to Lua?

BlitzMax Forums/BlitzMax Programming/Passing a Table to Lua?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Andreas, thank you for the detailed explanation. That all makes perfect sense, but I'm still missing one thing, which I think may be a conceptual misunderstanding on my part.

Let's suppose that all my BlitzMax objects have a method called Update() which does nothing but run whatever lua chunk has been associated with the object in question.

So I call the Lua Function ( let's assume I have various different update scripts and this one is called Update10 ) and pass the BMax object handle as light userdata. Now Lua has the BMax object handle, but it doesn't have a Lua object ( in this case table ) so I don't know where it gets the object from to start calling the "methods" you can fake with metatables. Do you keep a table which contains BMax object handles as the key and Lua "objects" as the value and retrieve the right object each time? It's just this concept of getting the matching lua object to the BlitzMax object handle that's got me stumped at the moment.

Again, thanks for all the help.