hilber_angers Posted May 6, 2023 Share Posted May 6, 2023 i'm chinese and the following words are translated by chatgpt: Today, while examining the code in the official "preparedfoods" file, I noticed something strange. The code first defines a table called "prefabs" and then shallow copies it as "foodprefabs" within the "makepreparedfood" function. This means that any operation performed on "foodprefabs" is equivalent to operating on "prefabs." The code then inserts values into "foodprefabs" based on the recipe's prefabs for the food. I can understand that; it's essentially passing along which prefabs are involved in the food itself. Eventually, "foodprefabs" is used as a parameter for the "Prefab" function. However, there is an issue here. If I first run the code for food "a" and add the related prefab "A" to the "foodprefabs" table. Will this modification persist even when I subsequently run the code for food "B"? Will "prefabs" still contain "A" when running the "Prefab" function for "B"? This seems unnecessary and wasteful of space. Why not define "prefabs" within the "makepreparedfood" function? Or is it that the "Prefab" function itself requires the final table of all prefabs? If so, why are "assets" defined within the function? Link to comment https://forums.kleientertainment.com/forums/topic/147650-a-question-about-official-food-codes/ 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