It looks like you're new here. If you want to get involved, click one of these buttons!
I wrote 4 . 5 - 3 . 5 = ERROR!!
Why it is wrong? I thought it is good!
if key == "dot" then
if isNumber1 == true then
-- true
txt.value = txt.value .. "."
number = number .. "."
else
-- false
if operation ~= nil then
txt.value = txt.value .. "."
number = txt.value .. "."
else --if nil
alert("Operation is on nil! You can't use the comma!", "Error")
end
end
drawing = false
end
end
Comments
It says
arithmetic on a nil string value
It's exactly what it says. You have a string variable that's nil and you're trying to do arithmetic with it. You're not moving anything to one of the variables you're using.
But how to do it then, I created locals called
isComma
. True/F, how to work with it. My numbers are string creatednumber .. key
so there is a valuenumber .. "."
, - this whit the dot does not exist. Isn't there any way to solute the comma?Soluted! I wrote
number = txt.value
andtxt.value
is a string. Soluted!