Changes in class constructors. close #18

This commit is contained in:
Van
2026-01-20 21:42:16 +03:00
parent 8c7aaefe09
commit d392414cb7
4 changed files with 16 additions and 8 deletions

View File

@@ -1,3 +1,5 @@
local getInstance = Class.getInstance
---@class Formspec
---@field params string
---@field elements string
@@ -45,7 +47,7 @@ local Formspec = {
---@return Formspec
function Formspec:new(def)
if def == nil then
local instance = setmetatable({}, {__index = self})
local instance = getInstance(self, {})
return instance
end
@@ -98,9 +100,9 @@ function Formspec:new(def)
local allowClose = ('allow_close[%s]'):format(def.allowClose or true)
---@type Formspec
local instance = setmetatable({
local instance = getInstance(self, {
params = version..size..position..anchor..padding..noPrepend..realCoordinates..allowClose,
}, {__index = self})
})
return instance
end