So I'm trying to learn LUA but I can't get a script working idk what is wrong
I have this script:
it prints "it doesn't work" whatever number I type in.
also when I add
to the end they are both printed correctly
idk what is wrong i spent so much time trying to fix it but no success it's probably smthing very easy so maybe someone can help. thx
edit:Apparently I was missing "tonumber" because read() returns a string
I have this script:
Lua:
function firstNumber()
local number = math.random(1,1)
return number
end
function secondNumber()
write("Type a number")
local number2 = read()
return number2
end
local numberone = firstNumber()
local numbertwo = secondNumber()
if numberone == numbertwo then
print("It works!")
else print("It doesn't work!")
end
also when I add
Lua:
print(numberone)
print(numbertwo)
idk what is wrong i spent so much time trying to fix it but no success it's probably smthing very easy so maybe someone can help. thx
edit:Apparently I was missing "tonumber" because read() returns a string
Last edited: