Attract-Mode Support Forum
Attract-Mode Support => Scripting => Topic started by: zpaolo11x on April 12, 2019, 04:57:24 AM
-
I have this simple code:
local key_names = { "1": "A", "2": "B", "3": "C", "4": "D"}
foreach (key,val in key_names){
print (key + " " + val +"\n")
}
Maybe I don't get it right but the console output of this code is
1 A
3 C
2 B
4 D
I would expect it to return
1 A
2 B
3 C
4 D
Also speaking of tables, what is the difference between something like this:
local aTable = { "first_key" : "Max Normal",
"second_key" : 42,
"third_key" : true};
and this:
local aTable = { "first_key" = "Max Normal",
"second_key" = 42,
"third_key" = true};