Code: Select all
local circle_list = {}
for x = -5,5 do
for y = -5,5 do
table.insert(circle_list, {x=x,y=y})
end
end
table.sort(circle_list, function (k1,k2) return math.sqrt((k1.x^2)+(k1.y^2)) < math.sqrt((k2.x^2)+(k2.y^2)) end )
It's deterministic, right?
... Isn't it?
I could do the following:
1. Believe it's deterministic and will always have the same result on any machine, so it's desync-safe, so I can just keep it in a local variable and treat it as a constant.
2. Keep it in the global table to be safe, but it will be sent around the network a fair bit even though it never changes during a game session.
3. Dump it to a text file, turn that output into a Lua table, and require it as fixed data. And then have to re-do all of that if I ever need it to change.
I want 1 because I'm lazy. But paranoia reigns. What would you do?