Failed: bad key to string index (number expected, got string)
2 replies, posted
Hi everyone,
I'm really sorry if this is a repost. I've been banging my head against the table for a few hours trying to figure this out.
Error:
Hook 'KaosMod.setPropOwner' Failed: bad key to string index (number expected, got string)
gamemodes/kaosmod/gamemode/init.lua:149
[code]
function KaosMod.addEntity(player, entity)
local entityID = entity:EntIndex();
local playerID = player:UserID();
Props[entityID] = {playerID} // Line 149
PrintTable(Props)
end
[/code]
It keeps saying that it's a string, however, I've used Type(playerID) which returns saying it's a number. Both player and entity are legit.
Just try using ToNumber function to see if it changed anything.
Not sure how, but now I'm getting the same error on this line:
[code]
local playerID = player:UserID();
[/code]
[editline]2nd April 2012[/editline]
Cancel this, I was calling the wrong hook...
Sorry, you need to Log In to post a reply to this thread.