I’m just coding around experimenting with how functions work and am stumped of the outcome of this code. The outcome to the console is … string string works. Now I don’t understand why string is printed twice. If i make a == a real number it prints the number twice also… If i remove the function ret() then it only prints once. Whats going on?
[lua]a = “stringS”
b = 5
function calc()
if (type(a) == “number”) then
print (a + 10)
elseif (type(a) ~= “number”) then
print (type(a))
return type(a)
end
end
calc()
function ret()
if (calc() == “string”) then
print (“Works!”)
end
end
ret() [import]uid: 20272 topic_id: 34803 reply_id: 334803[/import]