Jump to content

ipairs problem


Recommended Posts

Hi, i've got a big problem 

 

for index, factionTable in ipairs ( factionDuty ) do    -- Loop all the factions
        if isPlayerInFaction(targetPlayer, factionTable["factionID"]) then
            for index, factionPackage in ipairs ( factionTable["packages"] ) do -- Loop all the faction packages
                local found = false
                for index, packageColShape in ipairs ( factionPackage["colShape"] ) do -- Loop all the colshapes of the factionpackage
                    if isElementWithinColShape( targetPlayer, packageColShape ) then
                        found = true
                        break  -- We found this package already, no need to search the other colshapes
                    end
                end
                
                if factionPackage.vehicle and getPedOccupiedVehicle( targetPlayer ) and factionPackage.vehicle[ getElementModel( getPedOccupiedVehicle( targetPlayer ) ) ] then
                    found = true
                end
                
                if found and canPlayerUseDutyPackage(targetPlayer, factionPackage) then
                    table.insert(availablePackages, factionPackage)
                end
            end
        end
    end

I have this error :bad argument #1 to 'ipairs' (table excepted, got nil)

 

Can you help me ? Thank's

Link to comment
Just now, StormFighter said:

I thik, factionTable is your table and factionDuty is the variable you want. Now... factionDuty is in ipairs() where factionTable should be.

Your error message said that ipairs has a nil, not a table.

So i have to make factiontable in the ipairs ? I don't understand..

Edited by Charlekraft
edit
Link to comment

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...