Posted 08 March 2012 - 01:40 AM
Hey I have been learning LUA and my freind knows it too we made this program using the normal Lua program on my laptop.
I went home and copied it into my save disk on Minecraft and loaded it up.
It loads up all fine but if I try 1 it lets me put in user name and pass but it tells me "io:27: Unsupported mode".
If i try 2 it will tell me "register.lua:23: attempt to index ? (a nil value)".
Would this be Computercraft doesn't support io.write or io.read? It works fine on my Lua program.
I went home and copied it into my save disk on Minecraft and loaded it up.
-- Register
function register()
-- ask for name
print("Enter your user name.")
name = io.read()
-- ask for password
print("Enter your password.")
pass = io.read()
-- save to file
f = io.open("users.txt", "a+")
f:write("\n\n"..name.."\n"..pass)
f:close()
print("Saved to file! Thank you!")
end
-- List users
function list()
-- read list
g = io.open("users.txt", "r")
t = g:read("*a")
g:close()
-- print to screen
io.write(t)
end
-- Ask user for option
print("Would you like to:")
print("1. Register")
print("2. List users")
u = io.read()
if u == "1" then
register()
else
list()
end
-- end of program
print("\nEnd of program press enter.")
e = io.read()
It loads up all fine but if I try 1 it lets me put in user name and pass but it tells me "io:27: Unsupported mode".
If i try 2 it will tell me "register.lua:23: attempt to index ? (a nil value)".
Would this be Computercraft doesn't support io.write or io.read? It works fine on my Lua program.