Jump to content

Error whith table insert line. PLEASE HELP ME!


Murilo_apa

Recommended Posts

function giveV(player, car_id)
    if player then
        if car_id then
            local car_id = tonumber(car_id);
            local dados = getElementData(player, 'garagem');
            for i,v in ipairs(dados) do
                if not v.id == car_id then
                    table.insert(dados, {id = car_id, v.spawned = false})
                else
                    return false
                end
            end
        else
            return false
        end
    else
        return false
    end
end

So, I'm having difficulties with an error in a line where I use table.insert, I don't know if this is the real problem.
(I'm using the translator)

ERROR: Loading script failed: [src]concessionaria\conceC.lua:201: '}' expected near '=';

Thanks in advance.

Link to comment
function giveV(player, car_id)
    if player then
        if car_id then
            local car_id = tonumber(car_id);
            local dados = getElementData(player, 'garagem');
            for i,v in ipairs(dados) do
                if not v.id == car_id then
                    table.insert(dados, {id = car_id, spawned = false})
                else
                    return false
                end
            end
        else
            return false
        end
    else
        return false
    end
end

 

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