-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
26 lines (22 loc) · 740 Bytes
/
main.lua
File metadata and controls
26 lines (22 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function mainloop()
updateParser();
if(current.room == nil) then error("The player is not in a room"); end
current.room.visited = true;
current.room:describe();
current.turncount = 0;
while(current.running and current.living) do
if(current.room == nil) then error("The player is not in a room"); end
io.write(current.prompt());
local input = io.read("*line");
if(input == nil or input == "quit") then break; end
io.write("\n");
local res = parse(input);
if(res ~= "Success") then
io.write(string.format("I'm sorry, I couldn't understand you. %s\n", res));
else
current.turncount = current.turncount + 1;
end
current.eachTurn();
end
print();
end