Please forgive me if I am using the wrong words. I don't know Lua.
The data structure returned by the getStack() function isn't consistent which can crash the Lua interpreter.
Assume we have an industrial storage container with the network ID “whatever.” There is a stack of items in the first inventory slot. The stack is NOT full. Think 31 turbo motors instead of 50.
The “stack.item.type” property doesn't exist and would cause a runtime error if called directly.
getStack(x) will return a data structure containing “item.type” if and only if the stack is full. For example a stack of 50/50 super computers does have the type property. A stack of 49/50 supercomputers does NOT!
Please forgive me if I am using the wrong words. I don't know Lua.
The data structure returned by the getStack() function isn't consistent which can crash the Lua interpreter.
Assume we have an industrial storage container with the network ID “whatever.” There is a stack of items in the first inventory slot. The stack is NOT full. Think 31 turbo motors instead of 50.
container = component.proxy(“whatever”) inventory = container:getInventories()[1] stack = inventory:getStack(1) itemname = tostring(stack.item.type) print(itemname)
The Lua engine will print: “nil”
The “stack.item.type” property doesn't exist and would cause a runtime error if called directly.
getStack(x) will return a data structure containing “item.type” if and only if the stack is full. For example a stack of 50/50 super computers does have the type property. A stack of 49/50 supercomputers does NOT!