fix: view.width functions may return strings (#3020)

* Fix get_size() function when size is a function return string

* update view.width help

---------

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
Jie Liu
2024-12-08 08:45:32 +08:00
committed by GitHub
parent 375e38673b
commit 6b4be1dc0c
2 changed files with 5 additions and 5 deletions

View File

@@ -119,7 +119,7 @@ local function get_size(size)
if type(size) == "number" then
return size
elseif type(size) == "function" then
return size()
return get_size(size())
end
local size_as_number = tonumber(size:sub(0, -2))
local percent_as_decimal = size_as_number / 100