Closed jacobdufault closed 9 years ago
The behavior is correct and is the same as if you wrote
_ENV["top.lower"]=1
In Lua.
If you want to set a value in a table use
script.Globals["top", "lower"]=1
----- Messaggio originale ----- Da: "Jacob Dufault" notifications@github.com Inviato: 30/08/2015 06:12 A: "xanathar/moonsharp" moonsharp@noreply.github.com Oggetto: [moonsharp] Assigning a global inside of a nested table doesn't work(#109)
Running inside of Unity, Script script = new Script(CoreModules.Preset_SoftSandbox);
script.Options.DebugPrint = Debug.Log;
script.DoString("top = {}"); script.Globals["top.lower"] = 1; script.DoString("print(top.lower)"); This should print 1 but instead it prints nil. I've worked around this issue with private static void AssignGlobal(Script script, string globalName, object value) { script.Globals["_tmp"] = value; script.DoString(globalName + " = _tmp ; _tmp = nil"); }— Reply to this email directly or view it on GitHub.
sg
Running inside of Unity,
This should print
1
but instead it printsnil
.I've worked around this issue with