An interpreter for the Lua language, written entirely in C# for the .NET, Mono, Xamarin and Unity3D platforms, including handy remote debugger facilities.
function showTable(t)
for i, j in pairs(t) do
print(j)
end
end
tb = {}
tb["id"] = 3
print("Before:")
showTable(tb)
tb["id"] = nil
print("After:")
showTable(tb)
print("End")
outputs this:
Before:
3
After:
End
while in Moonsharp it outputs:
Before:
3
After:
nil
End
In my script I want to add and remove a lot of values in a table so I always end up with a huge table filled with nil values, which is useless. table.remove(tbl, pos) don't work because pos must be an integer of the position, and can't be a string for the key like here with the associative array.
In Lua 5.2, this code:
outputs this:
while in Moonsharp it outputs:
In my script I want to add and remove a lot of values in a table so I always end up with a huge table filled with nil values, which is useless.
table.remove(tbl, pos)
don't work because pos must be an integer of the position, and can't be a string for the key like here with the associative array.