sonic-radiance/sonic-radiance.love/birb/modules/gui/elements/linked.lua
2021-08-21 12:45:49 +02:00

21 lines
No EOL
608 B
Lua

local Parent = require "birb.modules.gui.elements.parent"
local LinkedElement = Parent:extend()
function LinkedElement:new(name, x, y, w, h, object, varName)
LinkedElement.super.new(self, name, x, y, w, h)
self.object = object
self.variables = {}
self:addVariable(varName, "main")
end
function LinkedElement:addVariable(varName, internalName)
internalName = internalName or varName
self.variables[internalName] = varName
end
function LinkedElement:getVariableContent(varName)
varName = varName or "main"
return self.object[self.variables[varName]]
end
return LinkedElement