Possible to print localised_strings to headless server console?
Posted: Thu Apr 06, 2023 6:19 pm
I've been using the "print()" function to print to the server console (stdout) which works. Now I'm trying to print custom death messages and running into an issue.
Let's say I want to print "Credomane has died to a Small biter." when I die to a, well, small biter. So what I naively tried to do was
Instead of the expected message I get "table" printed to stdout. Seems that the print() function doesn't handle localised_strings? I know game.print() does and so does every other method I know of but I need it in the headless console without printing it to players. The only method I know of for printing to stdout is "print()". "log()" from what read does handle localised_strings but it outputs to factoro-current.log and not stdout.
Let's say I want to print "Credomane has died to a Small biter." when I die to a, well, small biter. So what I naively tried to do was
Code: Select all
script.on_event(defines.events.on_player_died, function(event)
local p = game.players[event.player_index];
local c = event.cause
if not c then
print("**" .. p.name .. "** died.");
else
print({"", "**" .. p.name .. "** died to a " , c.localised_name, "."});
end
end)