[1.1.26] serpent.dump fails to dump recipe table

Bugs that are actually features.
Post Reply
Plawerth
Fast Inserter
Fast Inserter
Posts: 118
Joined: Thu Mar 02, 2017 12:57 am
Contact:

[1.1.26] serpent.dump fails to dump recipe table

Post 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?

User avatar
bormand
Fast Inserter
Fast Inserter
Posts: 201
Joined: Fri Jun 05, 2020 9:59 am
Contact:

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

Post 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

Post Reply

Return to “Not a bug”