#Hulk Posted April 10, 2018 Share Posted April 10, 2018 (edited) Hello , I need help with this code please , wrong in line 4 : Bad argument #1 to 'pairs' (table expected, got number) local factionTable = getElementData(getLocalPlayer(), "faction") local organizedTable = {} for i, k in pairs(factionTable) do organizedTable[k] = i end --#Hulk for k, id in ipairs(organizedTable) do if id ~= factionID then ftab[id] = guiCreateTab(getFactionName(id), ftabs) setElementData(ftab[id], "factionID", id) addEventHandler("onClientGUITabSwitched", ftab[id], loadFaction, false) end end Edited April 10, 2018 by #Hulk Link to comment
DNL291 Posted April 10, 2018 Share Posted April 10, 2018 getElementData isn't returning a table, but a number instead. Link to comment
#Hulk Posted April 10, 2018 Author Share Posted April 10, 2018 (edited) 14 minutes ago, DNL291 said: getElementData isn't returning a table, but a number instead. What should i do in this ? added return or what ? Edited April 10, 2018 by #Hulk Link to comment
DNL291 Posted April 10, 2018 Share Posted April 10, 2018 You must know why a number is being passed to it. Search for all setElementData's with the key "faction" to try find the problem. 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