majuck Posted June 3, 2022 Share Posted June 3, 2022 (edited) I've been testing out my unfinished custom foods, and I've run into this issue that I do not know how to fix. Once I put all the ingredients in the cook pot and attempt to cook it, an error pops up. I do not have the screenshot, but I have the logs where it says this ":29: attempt to compare number with nil" Now, I've googled about this but I couldn't find one for food so the only thing I understood from it is that I put something in the wrong order, I don't know what exactly, but I can't find anything clearly problematic on that line so I'm confused. I've attached the file and logs, if someone needs more info, feel free to ask. Just a heads up, I'm still new to coding. Anyway, I'll be glad if anyone will be able to help! Thanks in advance. sweet_cooking.lua client_log.txt Edited June 5, 2022 by majuck Link to comment Share on other sites More sharing options...
Bumber64 Posted June 4, 2022 Share Posted June 4, 2022 (edited) You need to change everything in the form names.ice >= 2 to (names.ice or 0) >= 2 because they're nil when not found in the cook pot, which causes an error when compared to a number. The solution compares 0 to a number instead when not used. Specifically, your crash occurred when performing the dragonfruit_ice_cream test (on line 29) without any dragonfruit in the cook pot, which it does before it checks the lower priority recipe you were actually trying to make. You should also make use of AddCookerRecipe("portablecookpot" and AddCookerRecipe("archive_cookpot" so players can cook your recipes in those. Edited June 4, 2022 by Bumber64 1 1 Link to comment Share on other sites More sharing options...
majuck Posted June 5, 2022 Author Share Posted June 5, 2022 22 hours ago, Bumber64 said: You need to change everything in the form names.ice >= 2 to (names.ice or 0) >= 2 because they're nil when not found in the cook pot, which causes an error when compared to a number. The solution compares 0 to a number instead when not used. Specifically, your crash occurred when performing the dragonfruit_ice_cream test (on line 29) without any dragonfruit in the cook pot, which it does before it checks the lower priority recipe you were actually trying to make. You should also make use of AddCookerRecipe("portablecookpot" and AddCookerRecipe("archive_cookpot" so players can cook your recipes in those. Thank you so much, it worked! Link to comment 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