Cyde042 Posted October 13, 2016 Share Posted October 13, 2016 I'm not talking about where to find them, but how to get access them as to change them. The last 2 lines were added by me but while I don't crash on recipes_warly, I do crash when it tries to index it. local require = GLOBAL.require local cooking = require "cooking" local recipes = cooking.recipes.cookpot --local warly = require "prefabs/warly" local recipes_warly = cooking.recipes.portablecookpot Non-Warly crock pot food - works recipes.californiaroll.test = function(cooker, names, tags) return (names.seaweed and names.seaweed == 2) and (tags.fish and tags.fish >= 1) and not tags.frozen and not tags.inedible end Warly crock pot food - crash recipes_warly.sweetpotatosouffle.test = function(cooker, names, tags) return (names.sweet_potato and names.sweet_potato == 2) and tags.egg and tags.egg >= 2 and not tags.frozen and not tags.inedible end Please help me out. Link to comment https://forums.kleientertainment.com/forums/topic/70833-how-to-access-warlys-recipes/ Share on other sites More sharing options...
Mobbstar Posted October 13, 2016 Share Posted October 13, 2016 (edited) If I recall correctly, "require" only loads the file once, then it loads a cached package. Here's a great example of this: http://lua-users.org/wiki/ModulesTutorial package.loaded.PACKAGENAME is the returned value (in this case, "package.loaded.cooking" is the table you nicknamed "cooking") Edited October 13, 2016 by Mobbstar Link to comment https://forums.kleientertainment.com/forums/topic/70833-how-to-access-warlys-recipes/#findComment-824444 Share on other sites More sharing options...
Cyde042 Posted October 13, 2016 Author Share Posted October 13, 2016 3 hours ago, Mobbstar said: If I recall correctly, "require" only loads the file once, then it loads a cached package. Here's a great example of this: http://lua-users.org/wiki/ModulesTutorial package.loaded.PACKAGENAME is the returned value (in this case, "package.loaded.cooking" is the table you nicknamed "cooking") I don't get what I'm supposed to make of this... sorry. I'm not even sure if the local variables are assigned correctly. If you look, the recipes are placed in Warly's prefab in table "specialtyfoods". Is the require warly part even corect? Link to comment https://forums.kleientertainment.com/forums/topic/70833-how-to-access-warlys-recipes/#findComment-824470 Share on other sites More sharing options...
Cyde042 Posted October 15, 2016 Author Share Posted October 15, 2016 @Mobbstar Can you help me please? It would be a bummer to leave the mod 1 line away from being finished. Link to comment https://forums.kleientertainment.com/forums/topic/70833-how-to-access-warlys-recipes/#findComment-825432 Share on other sites More sharing options...
Mobbstar Posted October 16, 2016 Share Posted October 16, 2016 if package.loaded.cooking then package.loaded.cooking.recipes.portablecookpot.sweetpotatosouffle.test = function(cooker, names, tags) ... end end I hope this clears your confusion. The first like checks if the package is loaded ( you could instead use "require" to load it if needed ) and the second directly accesses the wanted value, in this case, the test function. Link to comment https://forums.kleientertainment.com/forums/topic/70833-how-to-access-warlys-recipes/#findComment-825537 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now