optimize loops

This commit is contained in:
tenplus1 2020-06-19 11:33:33 +01:00
parent 4962d44be9
commit 3b8c4bc070
1 changed files with 9 additions and 7 deletions

16
api.lua
View File

@ -3016,11 +3016,11 @@ function mob_class:mob_staticdata()
self._cmi_components)
end
local tmp = {}
local tmp, t = {}
for _,stat in pairs(self) do
local t = type(stat)
t = type(stat)
if t ~= "function"
and t ~= "nil"
@ -3066,9 +3066,11 @@ function mob_class:mob_activate(staticdata, def, dtime)
if tmp then
local t
for _,stat in pairs(tmp) do
local t = type(stat)
t = type(stat)
if t ~= "function"
and t ~= "nil"
@ -4163,11 +4165,11 @@ function mobs:force_capture(self, clicker)
-- add special mob egg with all mob information
local new_stack = ItemStack(self.name .. "_set")
local tmp = {}
local tmp, t = {}
for _,stat in pairs(self) do
local t = type(stat)
t = type(stat)
if t ~= "function"
and t ~= "nil"
@ -4276,11 +4278,11 @@ function mobs:capture_mob(self, clicker, chance_hand, chance_net,
new_stack = ItemStack(mobname .. "_set")
local tmp = {}
local tmp, t = {}
for _,stat in pairs(self) do
local t = type(stat)
t = type(stat)
if t ~= "function"
and t ~= "nil"