[LUA] bad argument #1 to 'ipairs' (table expected, got nil)

Discussion in 'Support' started by Lejjo, Mar 16, 2012.

  1. Lejjo

    Lejjo Member

    Joined:
    Sep 21, 2007
    Messages:
    76
    What I wonder is what does this error output mean?

    Code:
    bad argument #1 to 'ipairs' (table expected, got nil)

    The code looks like this:

    Code:
    function spellSys:setCombatParam(paramType, value, ...)
    	for _, v in ipairs(arg) do <--This is where the error occur when I look in my GUI
    		setCombatParam(self:getCombat(v), paramType, value)
    	end
    end
    Thanks in advance!
  2. TGYoshi

    TGYoshi In space

    Joined:
    Aug 20, 2010
    Messages:
    1,107
    The first argument you've thrown into the function ipairs is nil, Lua (not LUA..) expects a table. You give it 'arg' which is an unassigned variable, aka nil.
  3. Lejjo

    Lejjo Member

    Joined:
    Sep 21, 2007
    Messages:
    76
    The thing is that it worked on TFS before but now it doesnt anymore. Back then I used TFS for 8.1 and now I use TFS 9.1

Share This Page