Tekken Posted March 8, 2015 Share Posted March 8, 2015 (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 March 8, 2015 by Guest Link to comment
Mr_Moose Posted March 8, 2015 Share Posted March 8, 2015 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
crismar Posted March 8, 2015 Share Posted March 8, 2015 Use tostring(neededparts). It appears that the specified element data doesn't exist, in this case it should display' false'. Link to comment
Tekken Posted March 8, 2015 Author Share Posted March 8, 2015 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. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now