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/misc.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/misc.lua')
-rw-r--r-- | builtin/game/misc.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua index d0e67bd88..4f58710d0 100644 --- a/builtin/game/misc.lua +++ b/builtin/game/misc.lua @@ -40,12 +40,12 @@ end) function core.after(after, func, ...) assert(tonumber(time) and type(func) == "function", "Invalid core.after invocation") - table.insert(jobs, { + jobs[#jobs + 1] = { func = func, expire = time + after, arg = {...}, mod_origin = core.get_last_run_mod() - }) + } end function core.check_player_privs(player_or_name, ...) @@ -63,14 +63,14 @@ function core.check_player_privs(player_or_name, ...) -- We were provided with a table like { privA = true, privB = true }. for priv, value in pairs(requested_privs[1]) do if value and not player_privs[priv] then - table.insert(missing_privileges, priv) + missing_privileges[#missing_privileges + 1] = priv end end else -- Only a list, we can process it directly. for key, priv in pairs(requested_privs) do if not player_privs[priv] then - table.insert(missing_privileges, priv) + missing_privileges[#missing_privileges + 1] = priv end end end @@ -96,7 +96,7 @@ function core.get_connected_players() local temp_table = {} for index, value in pairs(player_list) do if value:is_player_connected() then - table.insert(temp_table, value) + temp_table[#temp_table + 1] = value end end return temp_table |