Hello,
I wondered if there is a way to get the list of every lua variable from script. I mean : those declared in the current Database, and those declared on runtime ?
As far as I know, there is a lua array called Variable[], and we can use the function DialogueLua.GetVariable() from script, but only by using the name of the variable.
What would be the correct way to do it ?
Get a list of every local Lua variable.
Re: Get a list of every local Lua variable.
Hi,
Lua can return a table (array) as a return value. The AsTable property returns it as a LuaTableWrapper, so you can do this:
Lua can return a table (array) as a return value. The AsTable property returns it as a LuaTableWrapper, so you can do this:
Code: Select all
var variableTable = Lua.Run("return Variable").AsTable;
foreach (var variableName in variableTable.Keys) {
Debug.Log(variableName);
}