Posted 21 February 2016 - 01:42 AM
so i have a program for a city apartment complex that im building and i have a gui for it and a menu. when i run it, it says that it needs a then but there is already one there and i cant figure out the bug if anyone can help here is the code
btw the error is - "bios:14: [string "gui"]:32: 'then' expected
local sid = 0
function menu(id, text)
if sid == id then
write(">")
else
write(" ")
end
print(text)
end
while true do
term.clear()
term.setCursorPos(1,1)
print("+—CraftCity Apartment's—+")
print("| Who Are You? |")
print("| |")
print("| |")
print("| |")
print("| |")
print("+———————————+")
term.setCursorPos(3,14)
menu(0, "Owner")
term.setCursorPos(5,14)
menu(1, "Customer")
event, key = os.pullEvent("key")
if key == 200 then
if sid > 0 then
sid = sid - 1
end
elseif key == 28 then
sleep(1)
elseif sid == 1 then
sleep(1)
end
end
end
btw the error is - "bios:14: [string "gui"]:32: 'then' expected
local sid = 0
function menu(id, text)
if sid == id then
write(">")
else
write(" ")
end
print(text)
end
while true do
term.clear()
term.setCursorPos(1,1)
print("+—CraftCity Apartment's—+")
print("| Who Are You? |")
print("| |")
print("| |")
print("| |")
print("| |")
print("+———————————+")
term.setCursorPos(3,14)
menu(0, "Owner")
term.setCursorPos(5,14)
menu(1, "Customer")
event, key = os.pullEvent("key")
if key == 200 then
if sid > 0 then
sid = sid - 1
end
elseif key == 28 then
sleep(1)
elseif sid == 1 then
sleep(1)
end
end
end