undefined Posted October 25, 2014 Share Posted October 25, 2014 local nonparty = {} for _, player in ipairs(getElementsByType("player")) do if getElementData(player, "loggedin") then if type(getElementData(player, "party")) == "boolean" then table.insert(nonparty, string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")) -- Line 71 end end end What is the problem? Link to comment
FatalTerror Posted October 25, 2014 Share Posted October 25, 2014 Well, table.insert expect a number at the second argument. It's the position of the "insertion". Try something like: table.insert(nonparty, 0, string.gsub....) Link to comment
#DRAGON!FIRE Posted October 25, 2014 Share Posted October 25, 2014 No ! try this : local nonparty = {} for _, player in ipairs(getElementsByType("player")) do if getElementData(player, "loggedin") then if type(getElementData(player, "party")) == "boolean" then table.insert(nonparty, #nonparty+1, string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")) -- Line 71 end end end Link to comment
undefined Posted October 25, 2014 Author Share Posted October 25, 2014 Well,table.insert expect a number at the second argument. It's the position of the "insertion". Try something like: table.insert(nonparty, 0, string.gsub....) No !try this : local nonparty = {} for _, player in ipairs(getElementsByType("player")) do if getElementData(player, "loggedin") then if type(getElementData(player, "party")) == "boolean" then table.insert(nonparty, #nonparty+1, string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")) -- Line 71 end end end It's give other error again. I think, it's give error for string.gsub because when the i remove this, it's work. Link to comment
#DRAGON!FIRE Posted October 25, 2014 Share Posted October 25, 2014 try this : local nonparty = {} for _, player in ipairs(getElementsByType("player")) do if getElementData(player, "loggedin") then if type(getElementData(player, "party")) == "boolean" then nonparty [ #nonparty + 1 ] = string.gsub ( getPlayerName ( player ), "#%x%x%x%x%x%x", "" ) ) -- Line 71 end end end Link to comment
undefined Posted October 25, 2014 Author Share Posted October 25, 2014 It's not useful. And im solved it with this code: local name = string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "") table.insert(nonparty, name) It's strange! Thanks... Link to comment
TAPL Posted October 25, 2014 Share Posted October 25, 2014 It's because you forgot bracket of table.insert. table.insert(nonparty, string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "") Should be: table.insert(nonparty, string.gsub(getPlayerName(player), "#%x%x%x%x%x%x", "")) Link to comment
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