recipes = {
type1 = {
food1 = {name="Food 1", person=4, time=45, calorie=755, id=1},
food2 = {name="Food 2", person=4, time=45, calorie=755, id=2},
food3 = {name="Food 3", person=4, time=45, calorie=755, id=3},
food4 = {name="Food 4", person=4, time=45, calorie=755, id=4},
food5 = {name="Food 5", person=4, time=45, calorie=755, id=5},
food6 = {name="Food 6", person=4, time=45, calorie=755, id=6}
},
type2 = {
food1 = {name="Food 7", person=4, time=45, calorie=755, id=1},
food2 = {name="Food 8", person=4, time=45, calorie=755, id=2},
food3 = {name="Food 9", person=4, time=45, calorie=755, id=3},
food4 = {name="Food 10", person=4, time=45, calorie=755, id=4},
food5 = {name="Food 11", person=4, time=45, calorie=755, id=5},
food6 = {name="Food 12", person=4, time=45, calorie=755, id=6}
}
}
Comments
BTW in javascript there is a standard optimization where you cache length in a variable and reuse it and not getting length on every iteration of the loop. Does the same apply to lua?
Is there a difference in performance between:
It seems they are same in Lua.
Likes: ar2rsawseen