Added rec_print_children and rec_print_table to _fallback. Updated changelog.

This commit is contained in:
Kyzentun
2015-04-07 00:04:34 -06:00
parent 8c33bf92fb
commit 8aa2d42427
4 changed files with 100 additions and 0 deletions
+31
View File
@@ -4,6 +4,37 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes
from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt.
________________________________________________________________________________
2015/04/06
----------
* [global] rec_print_children and rec_print_table lua functions added to
_fallback. [kyzentun]
* [Language] Dutch translation updated. [Thumbsy]
* [RadarValues] Stream, Voltage, Air, Freeze, and Chaos are no longer capped
at 1. Stream and Voltage no longer count hold heads twice.
RadarCategory_Notes added, which counts all notes.
Scoring bug fixes related to radar calculation. [kyzentun]
* [ScreenSelectGame] Exit option returns to ScreenOptionsService unless the
game type actually changed. [Wallacoloo]
2015/04/04
----------
* [EditMode] Added submenus to the timing edit menu to allow shifting,
copying, and pasting any or all timing segments in the selected region or
after the current cursor position. [kyzentun]
Shifting menus in edit mode now have choices for 1, 2, or 4 measures or 2
beats. [kyzentun]
* [global] Fixed crash on OS X for certain dance pads when in Japanese
locale. [Wallacoloo]
2015/04/03
----------
* [ScreenGameplay] The NoteField board is now underneath everything except
the backgound. This means underneath any custom actors on the underlay or
overlay or decoration layers, and also underneath the combo/judgment even
when the ComboUnderField metric is true. [kyzentun]
Fixed bug in screen filter in default theme that made it not appear under
the field when a solo file was played without Center1Player. [kyzentun]
2015/04/02
----------
* [global] commify function exposed to lua. [kyzentun]
+2
View File
@@ -239,6 +239,8 @@
<Function name='rawequal'/>
<Function name='rawget'/>
<Function name='rawset'/>
<Function name='rec_print_children'/>
<Function name='rec_print_table'/>
<Function name='require'/>
<Function name='round'/>
<Function name='scale'/>
+8
View File
@@ -468,6 +468,14 @@ save yourself some time, copy this for undocumented things:
<Function name='ReadPrefFromFile' theme='_fallback' return='string' arguments='string prefName'>
[03 UserPreferences2.lua] (internal) Reads the specified user preference from its config file.
</Function>
<Function name='rec_print_children' theme='_fallback' return='' arguments='ActorFrame a, string indent'>
Recursively prints all the children of the actor frame to the log file. This can be useful for finding out what actors are on a screen or just seeing what the structure of the actor tree looks like.<br />
<code>indent</code> is an optional argument that will be prepended to every line.
</Function>
<Function name='rec_print_table' theme='_fallback' return='' arguments='table t, string indent'>
Recursively prints all values in the table to the log file in the form "(key_type) key: (value_type) value" so that you know the type of the key and the value. Useful if you're not sure exactly what is in a table passed as a parameter.<br />
<code>indent</code> is an optional argument that will be prepended to every line.
</Function>
<Function name='ReportStyle' return='void' arguments=''>
Sends the current style to the server.
</Function>
+59
View File
@@ -356,6 +356,65 @@ function IsUsingWideScreen()
end;
end;
-- Usage: Pass in an ActorFrame and a string to put in front of every line.
-- indent will be appended to at each level of the recursion, to indent each
-- generation further.
function rec_print_children(parent, indent)
if not indent then indent= "" end
if #parent > 0 and type(parent) == "table" then
for i, c in ipairs(parent) do
rec_print_children(c, indent .. i .. "->")
end
elseif parent.GetChildren then
local pname= (parent.GetName and parent:GetName()) or ""
local children= parent:GetChildren()
Trace(indent .. pname .. " children:")
for k, v in pairs(children) do
if #v > 0 then
Trace(indent .. pname .. "->" .. k .. " shared name:")
rec_print_children(v, indent .. pname .. "->")
Trace(indent .. pname .. "->" .. k .. " shared name over.")
else
rec_print_children(v, indent .. pname .. "->")
end
end
Trace(indent .. pname .. " children over.")
else
local pname= (parent.GetName and parent:GetName()) or ""
Trace(indent .. pname .. "(" .. tostring(parent) .. ")")
end
end
-- Usage: Pass in a table and a string to indent each line with.
-- indent will be appended to at each level of the recursion, to indent each
-- generation further.
-- DO NOT pass in a table that contains a reference loop.
-- A reference loop is a case where a table contains a member that is a
-- reference to itself, or contains a table that contains a reference to
-- itself.
-- Short reference loop example: a= {} a[1]= a
-- Longer reference loop example: a= {b= {c= {}}} a.b.c[1]= a
function rec_print_table(t, indent, depth_remaining)
if not indent then indent= "" end
if type(t) ~= "table" then
Trace(indent .. "rec_print_table passed a " .. type(t))
return
end
depth_remaining= depth_remaining or -1
if depth_remaining == 0 then return end
for k, v in pairs(t) do
if type(v) == "table" then
Trace(indent .. k .. ": table")
rec_print_table(v, indent .. " ", depth_remaining - 1)
else
Trace(indent .. "(" .. type(k) .. ")" .. k .. ": " ..
"(" .. type(v) .. ")" .. tostring(v))
end
end
Trace(indent .. "end")
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