drakylucas
Intermediate OT User
- Joined
- Dec 15, 2015
- Messages
- 236
- Solutions
- 7
- Reaction score
- 121
Hi all,
I don't know if it should be in support, or discussion
why does lua have this weird behavior?
this will print this out:
is there any reason for this to happen?
I'm just curious.
I don't know if it should be in support, or discussion
why does lua have this weird behavior?
Lua:
local table0 = {}
local table1 = {
[0] = "xx",
}
local table2 = {
[1] = "xx",
}
local table3 = {
[0] = "xx",
[1] = "yy",
}
local table4 = {
[0] = "xx",
[1] = "yy",
[2] = "yy",
}
local table5 = {
[1] = "xx",
[2] = "yy",
[3] = "yzy",
}
print("table0: " ..#table0)
print("table1: " ..#table1)
print("table2: " ..#table2)
print("table3: " ..#table3)
print("table4: " ..#table4)
print("table5: " ..#table5)
this will print this out:
if the table has an item with index "[0]", it is not counted in tablesize (using "#" symbol)table0: 0
table1: 0
table2: 1
table3: 1
table4: 2
table5: 3
is there any reason for this to happen?
I'm just curious.