16.12.2021, 06:31
@Erwin, I think you over-complicated the task there
Use this if you simply want to scramble already set values for tagged objects:
Use this if you simply want to scramble already set values for tagged objects:
Code:
math.randomseed(os.time())
objects = grp.tag('Scramble')
values = {}
for _, obj in ipairs(objects) do
values[ #values + 1 ] = obj.value
end
for _, obj in ipairs(objects) do
index = math.random(1, #values)
obj:write(values[ index ])
table.remove(values, index)
end