Jump to content

Can't change script in a mod.


Recommended Posts

local function cookbookPostConstruct(self)
    self.ApplySort = function(self)
        local sortby = TheCookbook:GetFilter("sort")
        table.sort(self.filtered_recipes,
                sortby == "alphabetical"    and function(a, b) return a.unlocked and not b.unlocked or (a.unlocked and b.unlocked and a.name < b.name) end
            or    sortby == "health"            and function(a, b) return (not(a.recipe_def.health == nil)) and (not(b.recipe_def.health == nil)) and ((a.unlocked and not b.unlocked) or (a.has_eaten and not b.has_eaten) or (a.has_eaten and ((a.recipe_def.health > b.recipe_def.health) or (a.recipe_def.health == b.recipe_def.health and a.name < b.name)))) end
            or    sortby == "hunger"            and function(a, b) return (not(a.recipe_def.hunger == nil)) and (not(b.recipe_def.hunger == nil)) and ((a.unlocked and not b.unlocked) or (a.has_eaten and not b.has_eaten) or (a.has_eaten and ((a.recipe_def.hunger > b.recipe_def.hunger) or (a.recipe_def.hunger == b.recipe_def.hunger and a.name < b.name)))) end
            or    sortby == "sanity"            and function(a, b) return (not(a.recipe_def.sanity == nil)) and (not(b.recipe_def.sanity == nil)) and ((a.unlocked and not b.unlocked) or (a.has_eaten and not b.has_eaten) or (a.has_eaten and ((a.recipe_def.sanity > b.recipe_def.sanity) or (a.recipe_def.sanity == b.recipe_def.sanity and a.name < b.name)))) end
            or    sortby == "sideeffects"        and function(a, b) return self:_sortfn_sideeffects(a, b) end
            or                                    function(a, b) return self:_sortfn_default(a, b) end
        )
        self.recipe_grid:SetItemsData(self.filtered_recipes)
        self:_DoFocusHookups()
    end
end
AddClassPostConstruct("widgets/redux/cookbookpage_crockpot", cookbookPostConstruct)

 

 

that is what i have in modmain.lua;
why isn't it working?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...