Page 1 of 1

[1.1.26] serpent.dump fails to dump recipe table

Posted: Sat Mar 06, 2021 6:34 pm
by Plawerth
Factorio 1.1.26

/c game.player.print ( serpent.dump ( ( game.player.force.recipes ) )
Cannot execute command: Error: (serpent):85 bad argument #3 of 3 to '_ _index' (string expected, got number)

Probably not what I want to do as it will scroll a hundred lines off the screen. I want the output written to a file.

But I'm just here to report a bug. I'll figure out the correct LUA later.

,

EDIT: This is not a vanilla game, it's got a pile o' mods, so it's possible the mods are causing this? But supposedly this should be able to dump "whatever" is in any table?

Re: [1.1.26] serpent.dump fails to dump recipe table

Posted: Sat Mar 06, 2021 6:59 pm
by bormand
Looks like LuaRecipes are objects from the C++ side, not usual tables. I doubt you can dump them that way... You can loop over them and dump their properties one by one, though.

https://lua-api.factorio.com/latest/LuaRecipe.html

Alternative approach is to dump them a bit earlier, at the data stage: https://mods.factorio.com/mod/DataRawSerpent