Skip to content

Instantly share code, notes, and snippets.

@ZwerOxotnik
Created October 8, 2021 18:24
Show Gist options
  • Save ZwerOxotnik/a23a20c6e134754f048a08c861083c79 to your computer and use it in GitHub Desktop.
Save ZwerOxotnik/a23a20c6e134754f048a08c861083c79 to your computer and use it in GitHub Desktop.
# game.players vs game.get_player
/measured-command for 1, 100 do local p = game.players[game.player.index] end
/measured-command for 1, 100 do local p = game.get_player(game.player.index) end
# Strings as key in tables vs comparing strings
/c SUBSPACE_ENTITIES_FOR_BUILT = {
["subspace-item-injector"] = true,
["subspace-item-extractor"] = true,
["subspace-fluid-injector"] = true,
["subspace-fluid-extractor"] = true
}
/measured-command
local text = "subspace-fluid-injector"
for i=1, 1000 do
if SUBSPACE_ENTITIES_FOR_BUILT[text] then end
end
/measured-command
local text = "subspace-fluid-injector"
for i=1, 1000 do
if name == "subspace-item-injector" or name == "subspace-item-extractor" or name == "subspace-fluid-injector" or name == "subspace-fluid-extractor" then
end
end
# Table initialisation with local members and static intialisation.
/measured-command for i=1, 1000 do local stack = {name = "test", count = 1} end
/measured-command local stack = {name = '', count = 1} for i=1, 1000 do stack.name = "test", stack.count = 1 end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment