Skip to content

Commit b9df196

Browse files
committed
Logger: add method for returning a table dump as a string
1 parent 1453b3f commit b9df196

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/DependencyControl/Logger.moon

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,11 @@ class Logger
110110

111111
-- taken from https://github.com/TypesettingCartel/Aegisub-Motion/blob/master/src/Log.moon
112112
dump: ( item, ignore, level = @defaultLevel ) =>
113+
@log level, @dumpToString item, ignore
114+
115+
dumpToString: ( item, ignore ) =>
113116
if "table" != type item
114-
return @log level, item
117+
return tostring item
115118

116119
count, tablecount = 1, 1
117120

@@ -145,7 +148,7 @@ class Logger
145148
recurse item, " "
146149
result[count+1] = "}"
147150

148-
@log level, table.concat(result, "\n")\gsub "%%", "%%%%"
151+
return table.concat(result, "\n")\gsub "%%", "%%%%"
149152

150153
windowError: ( errorMessage ) ->
151154
aegisub.dialog.display { { class: "label", label: errorMessage } }, { "&Close" }, { cancel: "&Close" }

0 commit comments

Comments
 (0)