Hi,
On LuaRecipe, you have group and subgroup that points to LuaGroup.
But I'd like to create a recipe browser (like the one that is used for crafting).
Is there a simple way to parse these groups/subgroups to recipes ?
Because I do not see any LuaForce.groups giving a liste of main groups,
not a LuaGroup.recipes giving the list of recipes in a subgroup...
Do I have to do this painful reverse engineering ?
Parsing recipes subgroups ?
Parsing recipes subgroups ?
My mods on the Factorio Mod Portal 

Re: Parsing recipes subgroups ?
loop on all recipes and build group and subgroup tables.
@see https://github.com/Helfima/helmod/blob/ ... roller.lua
@see https://github.com/Helfima/helmod/blob/ ... roller.lua
Code: Select all
-------------------------------------------------------------------------------
-- Return recipe groups
--
-- @function [parent=#PlayerController] getRecipeGroups
--
-- @param #LuaPlayer player
--
-- @return #table recipe groups
--
function PlayerController.methods:getRecipeGroups(player)
-- recuperation des groupes avec les recipes
local recipeGroups = {}
for key, recipe in pairs(self:getRecipes(player)) do
if recipe.group ~= nil then
if recipeGroups[recipe.group.name] == nil then recipeGroups[recipe.group.name] = {} end
table.insert(recipeGroups[recipe.group.name], recipe.name)
end
end
return recipeGroups
end