Perfomance fix for adding to table

This commit is contained in:
Kevin Taylor
2020-05-17 19:48:07 +01:00
parent 91f88b61e9
commit af07b76d98

View File

@@ -35,7 +35,7 @@ Commands.new_command('save-quickbar','Saves your Quickbar preset items to file')
for i=1, 100 do for i=1, 100 do
local slot = player.get_quick_bar_slot(i) local slot = player.get_quick_bar_slot(i)
if slot ~= nil then if slot ~= nil then
table.insert(quickbar_names, i, slot.name) quickbar_names[i] = slot.name
end end
end end
game.write_file("quickbar_preset.txt", player.name .. " = " .. serpent.line(quickbar_names) .. "\n", true) game.write_file("quickbar_preset.txt", player.name .. " = " .. serpent.line(quickbar_names) .. "\n", true)