local tab ={};
function tab:myFun(var,va1)
print(self) -- output 3
print(var,va1) -- output 4, nil
end
tab.myFun(3,4)
Asked
Active
Viewed 41 times
0

Oka
- 23,367
- 6
- 42
- 53

Harish Algat
- 11
- 2
-
Did you read books and all the documentation of [lua](https://lua.org/) ? Did you study its open source code (in C)? – Basile Starynkevitch Jun 29 '22 at 13:15
1 Answers
1
Instead of this:
tab.myFun(3,4)
You need to call it with:
tab:myFun(3,4)

Sunderam Dubey
- 1
- 11
- 20
- 40

Ivo
- 18,659
- 2
- 23
- 35