• Content count

  • Joined

  • Last visited

About LeCC

  • Rank
    Clan trial scripter

Profile Information

  • Gender

Recent Profile Visitors

438 profile views
  1. LeCC

    [Tutorial] Make more Object-Oriented scripts

    The way you use is simply using functions inside a table. It could be considered OOP, but using metatables is the official way in Lua. Also, your table is a local variable, just to point out. An example of using metatable method: a = {} a_mt = {__index = a} function a:create(test) local b = {} b.text = test return setmetatable(b,a_mt) end function a:give() return self.text end local c = a:create("Hey") c:give() -- This returns the string "Hey" As you can see, in this method you are able to use variable:functionname(), unlike yours. While both are fine, I personally recommend this one. //Edit: To be fair, I don't know which is the official one. For me it seemed this one, but I don't know.