diff options
Diffstat (limited to 'tutorials/tut030_inventories.md')
| -rw-r--r-- | tutorials/tut030_inventories.md | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/tutorials/tut030_inventories.md b/tutorials/tut030_inventories.md index fbf654d..41fb293 100644 --- a/tutorials/tut030_inventories.md +++ b/tutorials/tut030_inventories.md @@ -6,7 +6,7 @@ Many gamemode bases try to build an inventory system into the gamemode, leaving In this tutorial, we'll build a simple rougelike inventory, where we expect items to have a "weight", and we can carry as many items as we want, as long as we don't exceed our "max weight". -Inventories and items in Artery are just tables, as per usual in lua. They have a few required fields each. On the left, under "Classes", open invtbl and itemtbl in new tabs. +Inventories and items in Artery are just tables, as per usual in lua. They have a few required fields each. On the left, under "Classes" (all the way at the bottom!), open invtbl and itemtbl in new tabs. ## A simple inventory @@ -115,7 +115,8 @@ garrysmod/addons/artery_rougelite/data/artery/global/rougeinv.lua for k,v in pairs(self.items) do ser[k] = { v.Name, - v:Serialize() + v:Serialize() --Take advantage of the fact that all items must also have a + -- Serialize() method } end return util.TableToJSON(ser) @@ -142,3 +143,6 @@ garrysmod/addons/artery_rougelite/data/artery/global/rougeinv.lua That was a bit long, but we're done! This is the absolute minimum needed to create an Artery inventory. Now you can go in-game and use the console command `artery_printinventories`, and in that list, you will see your newly made inventory! + +Next tutorial: @{tut040_items.md} +Further reading: @{tut031_metatables.md} |
