Author Topic: MetaTables  (Read 2445 times)

0 Members and 1 Guest are viewing this topic.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
MetaTables
« on: February 20, 2017, 12:54:07 PM »
I've done some googling but I couldn't find anything helpful. I'm looking to find an existing list of MetaTables that exist. For all my addons that I've made to use players I could use FindMetaTable( "Player" ) but that's the only one I know of. Are there any more and/or a way to find them?
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: MetaTables
« Reply #1 on: February 20, 2017, 01:10:05 PM »
FindMetaTable just gives you the metatable (think: structure) that all objects of a given class use. Every object type should have a metatable---really, you're looking for entity/object classes.
bw81@ulysses-forums ~ % whoami
Homepage

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: MetaTables
« Reply #2 on: February 20, 2017, 01:14:24 PM »
Ohhh that makes a lot more sense now. So like Player:Ban is under the Player metatable, and something like Weapon:AllowsAutoSwitchFrom would have the Weapon metatable? Just examples of something in those, am I right in that assumption?


EDIT:


Also, is there a way to create a metatable? I'm trying to create something that accepts a string and then does stuff to it (say I wanted to do string:lower() instead of string.lower())
« Last Edit: February 20, 2017, 01:22:27 PM by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: MetaTables
« Reply #3 on: February 20, 2017, 01:19:50 PM »
Yes!

http://wiki.garrysmod.com/page/Main_Page

Click on Classes drop down. There you go! List of all the 'meta tables'

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: MetaTables
« Reply #4 on: February 20, 2017, 01:30:30 PM »
Yes!

http://wiki.garrysmod.com/page/Main_Page

Click on Classes drop down. There you go! List of all the 'meta tables'

You probably were posting that before I put in my edit, but is there a way to create a metatable? I'm trying to create something that accepts a string and then does stuff to it (say I wanted to do string:lower() instead of string.lower())
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given