1
2
3
4
5
6
2
3
4
5
6
function string:print() 	print(self) end a="12345" a:print() --prints "12345"
Works fine

1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
function table:print() 	for _,item in ipairs(self) do 		print(self) 	end end a={1,2,3,4,5} a:print() --returns method not found
Fails. And yes I have tried changing the method name.
I realize this requires metatables, but I have no idea what those are.