So, I've been making tables and assigning a single metatable, which had been defined in the different file, to them like this:
Code: Select all
function glob.class_workshop:new(entity)
workshop=
{entity=entity,
}
setmetatable(workshop,{__index=self})
return workshop
end
Code: Select all
table.insert(glob.workshops,glob.class_workshop:new(entity))
Code: Select all
function modupdate(tick)
if tick%20==0 and glob.active then
for _,workshop in ipairs(glob.workshops) do
workshop:check()
end
end
end
Code: Select all
for _,workshop in pairs(glob.workshops) do
workshop=reset_class_workshop(workshop)
end
Code: Select all
function reset_class_workshop(object)
setmetatable(object,{__index=glob.class_workshop})
return object
end