add notes about print being replaced in lua

This commit is contained in:
Chris Beck 2014-11-26 22:13:39 -05:00
parent 390e82530f
commit ad93493f87

View file

@ -211,6 +211,27 @@ If you must, you can disable the feature in one of the following ways:
Note that this change already revealed a bug in our core WML API as soon as it was implemented.
https://github.com/wesnoth/wesnoth/commit/d31253f585bd1e111705f59bdc37012ff6675f38
[*] In lua, the "print" function no longer writes to "standard out", and its output will not appear in the log files generated by the game. Instead its output only appears in the logs accessible via the in-game lua console.
For backwards compatability, the old print function (which comes with lua) has been renamed as "std_print" rather than being deleted. So if you need to print to standard out you can use that one. You also have the option of course to undo the change with
[code]
print = std_print
[/code]
but then the lua console log won't work.
Another option is to combine them using a closure:
[code]
function make_print()
local new_print = print
local old_print = std_print
return function(...)
old_print(...)
new_print(...)
end
end
print = make_print()
[/code]
[/list]
[section="Example section 2"]