Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- use with https://pastebin.com/PthjTNys
- -- make a folder called libs
- -- put this class in libs folder
- local clsTurtle = {}
- clsTurtle.__index = clsTurtle
- setmetatable(clsTurtle,
- {
- __call = function (cls, ...)
- return cls.new(...)
- end,
- })
- -- if you want to pass arguments at construction...
- function clsTurtle.new(name) --note dot, NOT colon, someValue = list of args or ... (table)
- local self = setmetatable({}, clsTurtle)
- if name == nil or name == "" then
- name = "Turtle"
- end
- self.name = name -- not used, placeholder for tutorial purposes
- self.x = 0
- self.y = 0
- self.z = 0
- self.facing = 0
- self.compass = ""
- self.equippedLeft = ""
- self.equippedRight = ""
- self.placeSlot = 0
- self.placeItem = ""
- self.osVersion = os.version() -- eg CraftOS 1.8
- return self
- end
- function clsTurtle.getName(self)
- return self.name
- end
- return clsTurtle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement