MaxLua and pub.Lua

BlitzMax Forums/BlitzMax Programming/MaxLua and pub.Lua

juankprada(Posted 2013) [#1]
Is it possible to mix both?
I need to register an BlitzMax object to be used in a Lua script which I see (maybe I am wrong) its only possible with MaxLua. But at the same time I would like the flexibility of pub.Lua (registering floats, integers, strings, etc)


Derron(Posted 2013) [#2]
This is surely not bugfree - but my current implemementation:

uses pub.lua
allows: registering objects in complete or selected ("all", "all but private", "all selected")


The .c-part may be done in a different way:

basefunctions_lua.c



basefunctions_lua_threaded.c



basefunctions_lua.bmx




Example



What is important: CONST and GLOBALS are not useable in my code, so you have to use Getters for them.

Most of the code is done by MaxLua already, I think many other thinks I had found in other code.

Ah, and many users will suggest you to just use the Lua-Glue-Creator also available in the forums but that is a thing of creating code dynamically - so changes need a "rebuild" ...


bye
Ron


EDIT:
If your "exposed" Type is eg. "TGame" (as "Game") and this type contains a list of "players:TList" and this TPlayers is exposed too (better with a helper like TGame.GetPlayer:TPlayer(i:int) ... the LUA-Script can even do something like:
Game.GetPlayer(1).aPublicFieldOfPlayer.

So are able to make kind of "collections".