As Hollywood doesnt normally support References to variables, here is how to get something equivalent to a reference to a variable In Hollywood.
Code: Select all
Function NewValueToVarReference(Table, Var, NewValue)
Table[Var] = NewValue
EndFunction
TestTable = {a = 1, b = 2}
NewValueToVarReference(TestTable, "a", 3)
VarToUse = "b"
NewValueToVarReference(TestTable, VarToUse, 4)
DebugPrint(TestTable.a)
DebugPrint(TestTable.b)
3
4
Do notice it is recommended to use small letters in variable names, as example, using:
Code: Select all
VarToUse = "B"Point for using noncapitalized is that there is no way to access Capital Letter named variables through regular table.var suffix.
You can assign
Code: Select all
TestTable["B"] = 2Code: Select all
Debugprint(TestTable["B"])Code: Select all
TestTable.b
TestTable.BWhile ["abc"], ["Abc"], and ["ABC"] all create their own unique variable, only way to access Abc or ABC, is by using table["Abc"], table["ABC"], everything else would try to access Table["abc"]
as example:
Code: Select all
Table.abc
Table.Abc
Table.ABC