I installed the LuaZM application for the Prizm and tried to run code for a factorial program with it.
Code:
Unfortunately every time I run this the error message
---
Lua\factorial.lua:11: attempt to index global 'io' (a nil value)
---
appears and prevents it from executing. I have little programming experience, but I thing it means the io.read() function isn't defined or something similar. If anyone can tell me what bits of code I'm missing that would be awesome.
Code:
function fact (n)
if n == 0 then
return 1
else
return n * fact(n-1)
end
end
print("enter a number:")
a = io.read("*number")
print(fact(a))
Unfortunately every time I run this the error message
---
Lua\factorial.lua:11: attempt to index global 'io' (a nil value)
---
appears and prevents it from executing. I have little programming experience, but I thing it means the io.read() function isn't defined or something similar. If anyone can tell me what bits of code I'm missing that would be awesome.