• Metatables?
    7 replies, posted
Well, What are these, How are they useful? Got any good documentaion. Alot of people tell me to learn these and that they will be useful, But cannot find a good place to start with hem, Thanks!
They let you modify how tables work and are accessed. [url]http://lua-users.org/wiki/MetatableEvents[/url] [url]http://wiki.garrysmod.com/page/Metamethods[/url] They're useful for creating class-like systems and adding support for mathematic operators on the table, among other unique things.
just to note, there is an issue with them randomly corrupting that hasn't been fixed [B][I]yet[/I][/B] which causes your entire server to fuck up/crash
[QUOTE=DannyCore;46923409]just to note, there is an issue with them randomly corrupting that hasn't been fixed [B][I]yet[/I][/B] which causes your entire server to fuck up/crash[/QUOTE] I don't think you understand this, metatables hold all the functions that can be ran an on object including all the functions included with gmod, as far as we know adding metatable entries doesn't affect it, and correct me if I'm wrong, but isn't the corruption bug Dev branch only?
[QUOTE=meharryp;46923563]I don't think you understand this, metatables hold all the functions that can be ran an on object including all the functions included with gmod, as far as we know adding metatable entries doesn't affect it, and correct me if I'm wrong, but isn't the corruption bug Dev branch only?[/QUOTE] Corruption has been live for a few updates now.
I'd suggest pretending that the "Metamethods" wiki tutorial doesn't exist.
Here's one that describes the functions: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/classes/class_tutorial.lua.html[/url] And here is an example ( cards ): [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/classes/class_card.lua.html[/url] Meta-tables are objects that can be cloned. They're quite useful in certain situations. The card example lets you either create cards / copies or pass in the value ( modded % so more than 1 deck can be used ) to achieve the same result without the overhead.
[QUOTE=Acecool;46926126]Meta-tables are objects that can be cloned.[/QUOTE] No.
Sorry, you need to Log In to post a reply to this thread.