Metatable question

Hello, i am making a metatable but every funcyion linked to it, does it go into the table itself ? Like

mahtable={}
function mahtable:print()
print( “hey”)
end

is mahtable[“print”] the function ?

Yes.

It is also mahtable.print

If you call it in either of those ways you will have to provide an extra argument for self :
[lua]mahtable"print"[/lua]

Kind of a bad example.

Snf it i had arguments for mahtable:print() saylike the first one would be … and would provide the text for print, where would i put the self argument?

Huh?

[lua]
tbl = {}
function tbl:print(…)
– self equals tbl
print(…)
end

function tbl.print(self,…)
print(…)
end

tbl:print(“Hello”)

  • Hello
    [/lua]

oh soory, just didnt get the answer :3 , when you said self, you mean the table provided ( in thestones case, tbl ):slight_smile:

Yes