The intention is for this to be a very simple vector class so I can manipulate 2d positions easily.
Here's the full code http://pastebin.com/Hmz9cfGz
I used the self variable because I'm using it as an object. Is that not what I'm supposed to use it for?
Search found 3 matches
- Wed Dec 14, 2016 3:34 am
- Forum: Support and Development
- Topic: Metatable issue
- Replies: 8
- Views: 5651
- Tue Dec 13, 2016 3:42 am
- Forum: Support and Development
- Topic: Metatable issue
- Replies: 8
- Views: 5651
Metatable issue
I'm trying to apply these two metamethods __add = function(this, obj) return vector.new(self.x + obj.x, self.y + obj.y) end, __sub = function(this, obj) return vector.new(self.x - obj.x, self.y - obj.y) end, to the table local self = { ["x"] = x and x or 0, ["y"] = y and y or 0 }...
- Fri Dec 02, 2016 11:30 pm
- Forum: Support and Development
- Topic: Creating classes/modules
- Replies: 3
- Views: 3999
Creating classes/modules
How would I create classes and modules? I've been using tables in the main file to use for classes but there has to be a better way (requiring classes in the folder?)