diff options
author | Rui914 <rui914t@gmail.com> | 2016-03-07 00:53:45 +0900 |
---|---|---|
committer | paramat <mat.gregory@virginmedia.com> | 2016-03-06 23:42:04 +0000 |
commit | 24e8b0ac1ea45719937948607259f13866c8bc64 (patch) | |
tree | f8bb110a59ca436d2a7a15686da8feab160a1c93 /builtin/game/chatcommands.lua | |
parent | 75db0543f3df4b30ce23731f5008d0c9afa277ff (diff) | |
download | minetest-24e8b0ac1ea45719937948607259f13866c8bc64.tar.gz minetest-24e8b0ac1ea45719937948607259f13866c8bc64.tar.bz2 minetest-24e8b0ac1ea45719937948607259f13866c8bc64.zip |
Faster insertion into table
Diffstat (limited to 'builtin/game/chatcommands.lua')
-rw-r--r-- | builtin/game/chatcommands.lua | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/game/chatcommands.lua b/builtin/game/chatcommands.lua index 6b4ca0d12..2c7a0b532 100644 --- a/builtin/game/chatcommands.lua +++ b/builtin/game/chatcommands.lua @@ -116,7 +116,7 @@ core.register_chatcommand("help", { local cmds = {} for cmd, def in pairs(core.chatcommands) do if core.check_player_privs(name, def.privs) then - table.insert(cmds, cmd) + cmds[#cmds + 1] = cmd end end table.sort(cmds) @@ -127,7 +127,7 @@ core.register_chatcommand("help", { local cmds = {} for cmd, def in pairs(core.chatcommands) do if core.check_player_privs(name, def.privs) then - table.insert(cmds, format_help_line(cmd, def)) + cmds[#cmds + 1] = format_help_line(cmd, def) end end table.sort(cmds) @@ -135,7 +135,7 @@ core.register_chatcommand("help", { elseif param == "privs" then local privs = {} for priv, def in pairs(core.registered_privileges) do - table.insert(privs, priv .. ": " .. def.description) + privs[#privs + 1] = priv .. ": " .. def.description end table.sort(privs) return true, "Available privileges:\n"..table.concat(privs, "\n") |