dual-universe / lua-examples

This repository has been created to serve as a sharing and learning platform for the Dual Universe community and the development of simple and complex Lua applications. You will find on this repo the examples released by Novaquark during the devblog and thread.
https://www.dualuniverse.game
GNU General Public License v3.0
59 stars 19 forks source link

Returns unusual values #25

Closed ghost closed 1 year ago

ghost commented 1 year ago

https://github.com/dual-universe/lua-examples/blob/d9ed4cb14c83c17313ae3dcd7ce8cc5f31ed016a/api-mockup/container.lua#L37

Calling this results in a returned table that contains the values "pack remove concat unpack sort move insert" rather than ID and quantity pairs as described.

Jericho1060 commented 1 year ago

what you are listing are the table methods in standard lua (table.pack(), table.remove(), ...) you should try to loop on the content before displaying the keys:

local content = container.getContent()
for i, itemSlot in ipairs(content) do
     --do what you want for every items in the container
end