diff --git a/.luacheckrc b/.luacheckrc index b557738..59fc4be 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -1 +1,2 @@ +---@diagnostic disable: lowercase-global std="love+luajit" diff --git a/concord/builtins/key.lua b/concord/builtins/key.lua index 7e571ed..7b23275 100644 --- a/concord/builtins/key.lua +++ b/concord/builtins/key.lua @@ -22,6 +22,10 @@ function Key:deserialize (data) self.value = getKey(self, data) end +function Key.__mt:__call() + return self.value +end + function Key:removed (replaced) if not replaced then local entity = self.__entity diff --git a/concord/component.lua b/concord/component.lua index 2b43779..981b999 100644 --- a/concord/component.lua +++ b/concord/component.lua @@ -95,6 +95,7 @@ end function Component:__initialize(entity, ...) local component = self:__new(entity) + ---@diagnostic disable-next-line: redundant-parameter self.__populate(component, ...) return component diff --git a/concord/entity.lua b/concord/entity.lua index 041e58e..29145fa 100644 --- a/concord/entity.lua +++ b/concord/entity.lua @@ -248,7 +248,8 @@ function Entity:serialize(ignoreKey) if not ignoreKey then data.key = component.value end - elseif (name ~= "__world") and (name ~= "__isEntity") and (component.__name == name) then + --We only care about components that were properly given to the entity + elseif Type.isComponent(component) and (component.__name == name) then local componentData = component:serialize() if componentData ~= nil then diff --git a/concord/world.lua b/concord/world.lua index 9303fe0..1f0c714 100644 --- a/concord/world.lua +++ b/concord/world.lua @@ -476,6 +476,7 @@ end return setmetatable(World, { __call = function(_, ...) + ---@diagnostic disable-next-line: redundant-parameter return World.new(...) end, })