Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 12 Oct 2015 09:48 PM |
I just made a module which allows you to have classes in your scripts.
Link: http://www.roblox.com/ClassService-Classes-in-RBX-Lua-item?id=305968706
An example:
require(305968706)()
class CreatePerson{ Name=""; Age=1; }
CreatePerson Jack; Jack.Name="Jack" Jack.Age=15 |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 12 Oct 2015 09:48 PM |
| now add inheritance!1 and static members |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2015 09:49 PM |
I beat you to that already. -_-
http://www.roblox.com/--item?id=130759239 |
|
|
| Report Abuse |
|
|
Dogejia
|
  |
| Joined: 08 Feb 2012 |
| Total Posts: 1873 |
|
|
| 12 Oct 2015 09:49 PM |
I don't really get the point of this, sorry
gcmi lg lpxtlc; Decode it with Vigenere Cipher, keyword is Doge, if you dare >:) |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
| |
|
|
| 12 Oct 2015 09:55 PM |
Mine uses custom userdatas that allow you to add and edit values and also lets you customize the length and call metamethods. It's basically a replicator of ROBLOX's instance system without a ton of limitations and irritating "you can't call this because we said so" blocks.
http://www.roblox.com/--item?id=130759239 |
|
|
| Report Abuse |
|
|
Dogejia
|
  |
| Joined: 08 Feb 2012 |
| Total Posts: 1873 |
|
|
| 12 Oct 2015 09:57 PM |
I have a question, what does this actually do, I'm confused
gcmi lg lpxtlc; Decode it with Vigenere Cipher, keyword is Doge, if you dare >:) |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2015 10:01 PM |
| And.. how does it work exactly? |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 12 Oct 2015 10:08 PM |
If you know a programming language you should probably know what classes are.
Anyways @cnt, I just finished the inheritance part, example:
class Person{ private={ Dead=false; }; public={ Name="Hello" } } |
|
|
| Report Abuse |
|
|
Dogejia
|
  |
| Joined: 08 Feb 2012 |
| Total Posts: 1873 |
|
|
| 12 Oct 2015 10:08 PM |
I know roblox programming and I never heard of it :) (Do you mean like type?)
gcmi lg lpxtlc; Decode it with Vigenere Cipher, keyword is Doge, if you dare >:) |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 12 Oct 2015 10:09 PM |
| http://www.tutorialspoint.com/cplusplus/cpp_classes_objects.htm |
|
|
| Report Abuse |
|
|
Dogejia
|
  |
| Joined: 08 Feb 2012 |
| Total Posts: 1873 |
|
|
| 12 Oct 2015 10:12 PM |
So its ClassName ._.
gcmi lg lpxtlc; Decode it with Vigenere Cipher, keyword is Doge, if you dare >:) |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 12 Oct 2015 10:38 PM |
@cnt, I ignored static since I can just do:
class Person{ Name="Yolo"; Count=0; Add=function()Count=Count+1 end } |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 13 Oct 2015 09:24 PM |
Made an update, now a __call tag.
class "Person"{ __call=function(args) print(table.concat(args,", ")) end; }
Person "Jack"{"Hello","Test",1,3,"Ahh ye"} |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2015 09:29 PM |
Tynezz What gets me is how you can do class Person {} |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 13 Oct 2015 09:31 PM |
| @cody, I could change it.. |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2015 09:32 PM |
What?
Is the proper syntax:
class Person {
}
or
class "Person" {
} |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
| |
|
kools
|
  |
| Joined: 11 Jan 2009 |
| Total Posts: 1659 |
|
|
| 13 Oct 2015 09:37 PM |
| Someone over at the LOVE2D community made a class system in lua that I throughly enjoy. Google 32 lines of goodness. |
|
|
| Report Abuse |
|
|
|
| 13 Oct 2015 09:41 PM |
'swat I thought.
Defining a class should have this:
constructor deconstructor public and private fields polymorphism methods a delete command that executes deconstructor then erases from memeory
class "Example" { --this would getfenv()["Example"] = this Example = function(self, a, b, c) self.a = a; self.b = b; self.c = c; end; ~Example = function(self) self:save(self.b) end; public = { save = function(self, i) Datastore:SetAsync("abc", i) end; }; private = {
} }
local ex = Example.new() -- invoke constructor and stuff, all in the class class.delete(ex) -- or getfenv()["delete"] = function() to delete stuff end
|
|
|
| Report Abuse |
|
|