easy_dev
|
  |
| Joined: 25 Feb 2016 |
| Total Posts: 46 |
|
|
| 07 Feb 2017 08:55 AM |
| How exactly do metatables work, and in which places are they best used for? |
|
|
| Report Abuse |
|
|
|
| 07 Feb 2017 09:16 AM |
metatables are pretty much like tables with events and they can be used for a ton of things
|
|
|
| Report Abuse |
|
|
|
| 07 Feb 2017 09:29 AM |
| local # # ## local mt = {__call = function() print("u called the table") end} setmetatable(a, mt) a() |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 07 Feb 2017 09:33 AM |
Metatables are regular tables. Nothing special about them.
Where things get interesting is when you add metamethods to them.
You can think of metamethods as fallback events. |
|
|
| Report Abuse |
|
|
AxonMega
|
  |
| Joined: 29 Aug 2014 |
| Total Posts: 2403 |
|
|
| 07 Feb 2017 09:47 AM |
| Metamethods allow you to make custom things happen to your table when different operators are used on it. |
|
|
| Report Abuse |
|
|
easy_dev
|
  |
| Joined: 25 Feb 2016 |
| Total Posts: 46 |
|
|
| 07 Feb 2017 10:46 AM |
| Metamethods were probably the word I was looking for, not metatables. But thanks for the help. |
|
|
| Report Abuse |
|
|
XCVlll
|
  |
| Joined: 23 Oct 2008 |
| Total Posts: 963 |
|
|
| 07 Feb 2017 10:49 AM |
here's all of them:
http://wiki.roblox.com/index.php?title=Metamethods |
|
|
| Report Abuse |
|
|
easy_dev
|
  |
| Joined: 25 Feb 2016 |
| Total Posts: 46 |
|
|
| 07 Feb 2017 11:07 AM |
| Aight. So far, I partially know how to use __call. |
|
|
| Report Abuse |
|
|