Jump to content

Help with loop


#Hulk

Recommended Posts

Posted (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 by #Hulk
Posted (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 by #Hulk
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...