Jump to content

[Help] attempt to concatentate


Recommended Posts

Hi, I got this error ?

attempt to concatentate 'needparts' (a bolean value)

This is the code:

local needparts = getElementData(veh, "needparts") 
local parts = getElementData(getElementData(veh, "parent"), "Parts_inVehicle") or 0 
local w = dxGetTextWidth(parts .. "/" .. needparts .. " Componenta de metal", 1.02, "default-bold")--Here it gives error. 

Edited by Guest
Link to comment

If this:

getElementData(veh, "needparts") 

is not set it will return false when you try to get it's value, that means "needparts" will be false as well, and false cannot be included into a string. Try this on line 1:

local needparts = getElementData(veh, "needparts") or 0 

, that will assign the default value to 0 just like you did on line 2.

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