Reputation: 425
I've been trying to use
local function TestFunction(event, player, command)
local accountId = Player:GetAccountId()
end
whichs 2nd line was copied straight from the ElunaLua wiki. On execcution I received the error
calling 'GetAccountName' on bad self (bad argument : Player expected, got table)
I suspected the "Player" to be a global argument, wondering how it can be a table and how to use said table?
Upvotes: 1
Views: 72
Reputation: 425
"Player" is actually a global table that holds the functions you can use on a Player type variable. So that player has all functions in "Player" table. This is why doing Player:GetAccountId() caused a bit of a different error than something like Player variable not existing.
To make it work, i used "player:GetAccountId()" instead of a capital P. This passes the method the variable named "player".
Upvotes: 1