Closed avivi55 closed 1 year ago
I took a look at what you shared, and I think I can help you out. It seems like you're using the wrong operator to access your function.
In Lua, you can call a function using the colon syntax: t:greetPerson(player)
. The neat thing about the colon operator is that it automatically passes the object behind the : indexer, (in this case, t
) as the first argument for you.
However, it looks like you're using the dot operator instead. You should switch to the colon operator. For example, if your function is defined as t.greetPerson = function(self, player) end
, you would access it as t:greetPerson(player)
(Which is the exact same as doing t.greetPerson(t, player)
).
More documentation on OOP in LUA
From what you've described, it seems like the issue doesn't lie with the repository itself, but rather with how you're accessing the function. Give the colon operator a shot and let me know if the problem persists. If you need any further assistance, feel free to reopen the issue!
I am sorry for my poor knowledge, thank you for your explenation.
Related to #3
When removing the
istable
function, I am prompted withwhen looking at line
35
:and the call (
63
) :As seen in the definition the function takes two parameters and putting anything as a first parameter fixes the output.
The cause is probably that it works in gmod as a lot of gmod functions have a
self
argument as first parameter.