Blitz Lua Faq |
|
BlitzLua is a Lua runtime environment written in BlitzMAX, a fast cross-platform BASIC compiler and run-time system for Windows 98/ME/2000/XP, MacOS X and Linux.
Why not use full userdata?
One question which often arises is why the author does not use "full userdata" (instead of "light userdata") and therefore does not offer directly mapped objects and automatic memory management (through the use of a __gc
metamethod)
The reason is BlitzMAX's garbage collection: "full userdata" objects completely "live on the Lua side" - there is no reference back to BlitzMAX which could prevent an object from being "garbage collected". Additionally, there is no direct way to pass a "full userdata" object from BlitzMAX to Lua - as a consequence, it is Lua itself which has to locate the "full userdata" object for a given BlitzMAX object (given by its pointer). Solving these two issues naturally leads to an implementation as described above.