Sprite:Load lua function can set additional texture hints by having a second argument. Also, rec_count_children slipped in Utilities somehow. (#1426)

This commit is contained in:
Kyzentun
2017-04-04 18:24:14 -06:00
committed by Colby Klein
parent b4e02821e8
commit dd9fa68fef
2 changed files with 25 additions and 0 deletions
+20
View File
@@ -415,6 +415,26 @@ function rec_print_table(t, indent, depth_remaining)
Trace(indent .. "end")
end
function rec_count_children(parent)
local total= 1
if #parent > 0 and type(parent) == "table" then
for i, c in ipairs(parent) do
total= total + rec_count_children(c)
end
elseif parent.GetChildren then
local pname= (parent.GetName and parent:GetName()) or ""
local children= parent:GetChildren()
for k, v in pairs(children) do
if #v > 0 then
total= total + rec_count_children(v)
else
total= total + rec_count_children(v)
end
end
end
return total
end
-- Minor text formatting functions from Kyzentun.
-- TODO: Figure out why BitmapText:maxwidth doesn't do what I want.
-- Intentionally undocumented because they should be moved to BitmapText ASAP