Jump to content

[Help] attempt to concatentate


Tekken

Recommended Posts

Posted (edited)

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

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

Posted

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.

Posted

Use tostring(neededparts). It appears that the specified element data doesn't exist, in this case it should display' false'.

Contact me if you are looking for a Web Developer.

3rd of October 2014 - Founder of RomaniaZ

Posted
Use tostring(neededparts). It appears that the specified element data doesn't exist, in this case it should display' false'.

Yes i figured out after i added "or 0".

Thank's anyway.

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

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