1daBread Posted August 24, 2014 Share Posted August 24, 2014 Trying to overwrite the CanBuild function in builder.lua.It always throws an error on GetRecipe. Not sure exactly how to make it see the function. Is there something I need to import. At this point I am just trying to overwrite the with the vanilla function (no changes).Code:local require = GLOBAL.requirelocal Builder = require "components/builder"local Recipe = GLOBAL.Recipelocal RECIPETABS = GLOBAL.RECIPETABSlocal TECH = GLOBAL.TECHfunction Builder:CanBuild(recname)if self.freebuildmode thenreturn trueendlocal recipe = GetRecipe(recname)if recipe thenfor ik, iv in pairs(recipe.ingredients) dolocal amt = math.max(1, RoundUp(iv.amount * self.ingredientmod))if not self.inst.components.inventory:Has(iv.type, amt) thenreturn falseendendreturn trueendreturn falseendError:...tarve/data/../mods/resurrectionstatuefix/modmain.lua:55: attempt to call method 'GetRecipe' (a nil value)LUA ERROR stack traceback:X:/Games/SteamLibrary/steamapps/common/dont_starve/data/../mods/resurrectionstatuefix/modmain.lua(55,1) in function 'CanBuild'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/craftslot.lua(122,1) in function 'Refresh'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/craftslot.lua(177,1) in function 'SetRecipe'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/crafting.lua(137,1) in function 'UpdateRecipes'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/crafting.lua(78,1) in function 'SetFilter'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/crafttabs.lua(93,1) in function 'selectfn'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/tab.lua(192,1) in function 'Select'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/tab.lua(44,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/widgets/widget.lua(112,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/screens/playerhud.lua(291,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/frontend.lua(236,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/input.lua(138,1) in function 'OnControl'X:/Games/SteamLibrary/steamapps/common/dont_starve/data/scripts/input.lua(312,1)scripts/frontend.lua(723,1) SCRIPT ERROR! Showing error screenForce aborting...if I do:local Recipe = require "recipe"...local recipe = Recipe:GetRecipe(recname)It throws an error attempt to index upvalue 'Recipe' (a boolean value) Link to comment Share on other sites More sharing options...
Heavenfall Posted August 24, 2014 Share Posted August 24, 2014 try local recipe = GLOBAL.GetRecipe(recname) Link to comment Share on other sites More sharing options...
1daBread Posted August 24, 2014 Author Share Posted August 24, 2014 Thank you again Heavenfall Link to comment Share on other sites More sharing options...
Recommended Posts
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.