Dice Posted June 20, 2013 Posted June 20, 2013 function triggerSwarm( myName ) runningStreaks[player] = getPlayerFromName ( myName ) runningStreaks[player].x, runningStreaks[player].y, runningStreaks[player].z = getElementPosition ( runningStreaks[player] ) end I tested myName with outputChatBox and it passes from client to server successfully.
xXMADEXx Posted June 20, 2013 Posted June 20, 2013 Try this: function triggerSwarm( myName ) runningStreaks[myName] = getPlayerFromName ( myName ) runningStreaks[myName].x, runningStreaks[myName].y, runningStreaks[myName].z = getElementPosition ( runningStreaks[myName] ) end
ixjf Posted June 20, 2013 Posted June 20, 2013 (edited) The error message is very obvious I guess. getPlayerFromName never ever returns a table but still you're using the return value as if it was one. In this case, getPlayerFromName shouldn't be finding a player with the specified name and so returning false. Edited June 20, 2013 by Guest
Moderators IIYAMA Posted June 20, 2013 Moderators Posted June 20, 2013 function triggerSwarm( player ) if not runningStreaks[player] then runningStreaks[player] = {} -- make it a table end runningStreaks[player]["name"] = getPlayerFromName (player ) -- insert name runningStreaks[player].x, runningStreaks[player].y, runningStreaks[player].z = getElementPosition ( runningStreaks[player] ) -- insert pos end
uhm Posted June 20, 2013 Posted June 20, 2013 also i dunno if im talking bs right now but do you ever do runningStreaks = {} in other words construct the runningStreaks table also y are u using both object notation and table notation ? is that allowed? idk legit question runningStreaks[player]["name"] = getPlayerFromName (player ) runningStreaks[player].x ------> runningStreaks[player]["name"] = getPlayerFromName (player ) runningStreaks[player]["x"] ----- ?
Moderators IIYAMA Posted June 20, 2013 Moderators Posted June 20, 2013 also i dunno if im talking bs right now but do you ever do runningStreaks = {} He must have because else it would start giving an error instead of a warning. ERROR: attempt to index a nil value. (title: Re: table index is nil) As far I know it is the same. runningStreaks[player].x runningStreaks[player]["x"] But I prefer ["x"]. When I use table.x, I always get confused that x is a not defined value.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now