Project Setup: The Room
Part of the Logic & Flow section of Coddy's Lua journey. Lesson 24 of 54.
Challenge
EasyYou're about to start building a text adventure game: a classic style of interactive fiction where players explore different locations by typing commands. Over the next several lessons, you'll create the foundation for this game piece by piece.
Create a table representing the starting room of your text adventure game. The room should have three fields: a name, a description, and an empty exits table.
Store the room in a variable called startingRoom with the following details:
name: "Ancient Library"description: "You find yourself in a dusty library filled with ancient books and scrolls."exits: An empty table (to be filled in future lessons)
Print the room's name and description on separate lines.
Expected Output Format:
Ancient Library
You find yourself in a dusty library filled with ancient books and scrolls.Try it yourself
All lessons in Logic & Flow
1Advanced Table Iteration
Iterating with pairs()Iterating with ipairs()pairs() vs. ipairs()Recap - Character Sheet2More Table Library Functions
table.concat()table construction & unpack()table.sort()Custom Sorting with FunctionsRecap - High Score Board5Project: Text Adventure Engine
Project Setup: The RoomLinking RoomsPractice on your own: Online Lua compiler