From 1dff6b21399fb6e02d7947d6b0b954ea51b33a47 Mon Sep 17 00:00:00 2001 From: Niels Martin Hansen Date: Thu, 18 Jan 2007 20:55:40 +0000 Subject: [PATCH] Auto4: Added aegisub.log as synonym for aegisub.debug.out Originally committed to SVN as r836. --- aegisub/auto4_lua.cpp | 3 +++ automation/tests/test9.lua | 6 +++--- automation/v4-docs/progress-reporting.txt | 6 +++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/aegisub/auto4_lua.cpp b/aegisub/auto4_lua.cpp index 4541bd965..cd3049bcb 100644 --- a/aegisub/auto4_lua.cpp +++ b/aegisub/auto4_lua.cpp @@ -718,6 +718,9 @@ namespace Automation4 { lua_pushcclosure(L, LuaDebugOut, 1); lua_setfield(L, -2, "out"); lua_setfield(L, -2, "debug"); + lua_pushvalue(L, -2); + lua_pushcclosure(L, LuaDebugOut, 1); + lua_setfield(L, -2, "log"); if (allow_config_dialog) { lua_newtable(L); diff --git a/automation/tests/test9.lua b/automation/tests/test9.lua index 74d2a8420..b8afef972 100644 --- a/automation/tests/test9.lua +++ b/automation/tests/test9.lua @@ -1,15 +1,15 @@ script_name = "Automation 4 test 9" script_description = "Test debug out function" script_author = "Niels Martin Hansen" -script_version = "1" +script_version = "2" function test9(subtitles, selected_lines, active_line) aegisub.debug.out("Only string argument\n") aegisub.debug.out("Hello %s!\n", "format string world") - aegisub.debug.out("Now going to output 7 strings with trace levels 0 to 6:\n") + aegisub.log("Now going to log 7 strings with trace levels 0 to 6:\n") for i = 0, 6 do - aegisub.debug.out(i, "Trace level %d...\n", i) + aegisub.log(i, "Trace level %d...\n", i) end aegisub.debug.out(3, "Finished!") end diff --git a/automation/v4-docs/progress-reporting.txt b/automation/v4-docs/progress-reporting.txt index 3d12affec..c6668b877 100644 --- a/automation/v4-docs/progress-reporting.txt +++ b/automation/v4-docs/progress-reporting.txt @@ -69,8 +69,12 @@ Returns: Boolean. True is the user has clicked the Cancel button, false if it Outputting text to the debug log +function aegisub.log([level,] msg, ...) function aegisub.debug.out([level,] msg, ...) +These two functions are synonyms. +aegisub.log is preferred since its name is shorter and more general. + @level (number) Integer describing the verbosity of this message. Here are some suggested values you can use: @@ -87,7 +91,7 @@ function aegisub.debug.out([level,] msg, ...) script won't see them unless he explicitly enables it. This argument is optional and can be left out, in which case the message will always be displayed, regardless of the current trace level set in - Aegisub. + Aegisub. You SHOULD however always include this argument. @msg (string) A format string used for the message.