MaxLua bug
BlitzMax Forums/BlitzMax Programming/MaxLua bug
| ||
bmx code:Type TTest Field path$ = "1.txt" End Type Local class:TLuaClass = TLuaClass.Create(LoadText("1.txt")) Local obj:TTest = New TTest Local lua:TLuaObject = TLuaObject.Create(class, obj) lua.Invoke("Pick", Null) Print obj.path Lua code '1.txt': function Pick() print(path); path = 'ok'; print(path); end console: 1.txt <-- Lua print() ok <-- Lua print() 1.txt <-- BlitzMax print() after lua call Why Lua creates a local variable? |
| ||
It creates a local as you tell lua to do so. If you used a different variable name for "fiels path" it would be more obvious. To access the obj's field "path" you need to access it via the exposed name of the obj. Edit: I suggest to read this: https://en.wikibooks.org/wiki/BlitzMax/Modules/System/Lua_scripting It will explain what is missing too (hint: registering the obj to lua) Bye Ron |