kirk24788 / KPS

Karnofsky Performance System
8 stars 11 forks source link

back with KPS function #32

Closed htordeux closed 7 years ago

htordeux commented 7 years ago

Kirk24788 wrote: Next line: {spells.mindFlay, 'test' , "target"}, -- returns always true This looks up 'test' in the environment, but the function doesn't get called - you would have write 'test()' for this, instead you have a simplification of 'test ~= nil', which is always true if the function exists

Thanks kirk, to update function usage, but... a test function without arg e.g. kps.env.priest.test() function kps.env.priest.test() if kps.multiTarget then return true end return false end

{spells.mindFlay, 'test()' }, -- return a lua error parser/lua:84 bad argument to unpack table expected got nil or un "fake" arg --{spells.mindFlay, 'test(1)' }, -- return true/false

htordeux commented 7 years ago

I change a bit the function parser.pop and now {spells.mindFlay, 'test()' }, retruens true/false and no lua errors

---[[[ Pop from Token List ]]--

function parser.pop(tokens)
    if tokens[1] then
        local t,v = unpack(tokens[1])
        table.remove(tokens, 1)
        return t,v
    else
        return "iden","()"
    end
end