From 5fd5f2b3d1c77c3b85355c452ffc7e1fe2e12162 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Wed, 28 Feb 2018 09:41:23 -0500 Subject: Fixed some types, worked on 0x050 Fixed typos in a bunch of tutorials, did a little more work on 0x050 - Entities --- tutorials/tut030_inventories.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tutorials/tut030_inventories.md') 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} -- cgit v1.2.3-70-g09d2