Originally Posted by Yhor
Does the current version allow for "105%" (or any % greater than 100)? I ask this because it may be useful for an
{ if blah blah blah = "10", then "100%";
if blah blah blah = "15", then "201%";
end... }
etc.. situation. Does that even make any sense?
|
Well, yes and no, you can use any n% as the width/height, but it currently cannot be changed on the fly like in your example since the config is only read once.
It's totally possible to implement that sort of behavior. For instance, allowing width/height to be a function and change itself conditionally.
But for the time being, to alter the width/height as a % conditionally, something like this could be used...
Code:
OnUpdate = function(self)
local height, width
if true then
height = "100%"
elseif condition == 5 then
height = "201%"
end
width = "100%"
local pwidth, pheight = self:GetParent():GetWidth(), self:GetParent():GetHeight()
if width then self:SetWidth(strmatch(width,"%%") and pwidth * strmatch(width, "(%d+)%%") * .01 or width) end
if height then self:SetHeight(strmatch(height,"%%") and pheight * strmatch(height, "(%d+)%%") * .01 or height) end
end