Looks like global tables, created during on_init, with length > 1024 don't have consistent ordering when iterating on server vs client later using "for k,v in pairs()"
My server is linux headless on ubuntu, client is windows steam. Not sure if you need more details on the platform differences... let me know if you do.
This is my control.lua file:
Code: Select all
script.on_init(function()
global.test_table = {}
for i = 1, 34 do
for j = 1, 34 do
table.insert(global.test_table, { x=i, y=j })
end
end
end)
Code: Select all
/c for k,v in pairs(global.test_table) do log(k) end
The end result is that when I compare my server vs client log files I found this:
Server Log:
Code: Select all
69.107 Script for k,v in pairs(global.test_table) do log(k) end:1: 1019
69.107 Script for k,v in pairs(global.test_table) do log(k) end:1: 1020
69.107 Script for k,v in pairs(global.test_table) do log(k) end:1: 1021
69.107 Script for k,v in pairs(global.test_table) do log(k) end:1: 1022
69.107 Script for k,v in pairs(global.test_table) do log(k) end:1: 1023
69.107 Script for k,v in pairs(global.test_table) do log(k) end:1: 1024
69.108 Script for k,v in pairs(global.test_table) do log(k) end:1: 1025
69.108 Script for k,v in pairs(global.test_table) do log(k) end:1: 1026
69.108 Script for k,v in pairs(global.test_table) do log(k) end:1: 1027
69.108 Script for k,v in pairs(global.test_table) do log(k) end:1: 1028
Code: Select all
152.705 Script for k,v in pairs(global.test_table) do log(k) end:1: 1019
152.705 Script for k,v in pairs(global.test_table) do log(k) end:1: 1020
152.705 Script for k,v in pairs(global.test_table) do log(k) end:1: 1021
152.705 Script for k,v in pairs(global.test_table) do log(k) end:1: 1022
152.705 Script for k,v in pairs(global.test_table) do log(k) end:1: 1023
152.705 Script for k,v in pairs(global.test_table) do log(k) end:1: 1024
152.705 Script for k,v in pairs(global.test_table) do log(k) end:1: 1050 <--- PROBLEM?
152.705 Script for k,v in pairs(global.test_table) do log(k) end:1: 1049
152.705 Script for k,v in pairs(global.test_table) do log(k) end:1: 1048
152.705 Script for k,v in pairs(global.test_table) do log(k) end:1: 1047