![]() |
I think I failed at my own guide - Printable Version +- 2DWorlds Forums (http://2dworlds.buildism.net/forum) +-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4) +--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13) +--- Thread: I think I failed at my own guide (/showthread.php?tid=9997) |
I think I failed at my own guide - DysLabs - 09-12-2012 Copying my old Custom Objects guide on the wiki, [lua] Int = {} function Int:new(one, two, three) newTB = {x, y, z} newTB.x = one newTB.y = two newTB.z = three function newTB.SetInt() --Here we create a method called SetInt() newTB.x = 90 newTB.y = 900 newTB.z = 9000 end return newTB end a = Int.new(5, 8, 10) print(a.x) --5 print(a.y) --8 print(a.z) -- 1 a:SetInt() print(newTB.x) --90 print(newTB.y) --900 print(newTB.z) --9000 [/lua] The result: wth? Wrote:8 umm? Oh hey - I don't know what I did - but it works now. |