Menu
Coddy logo textTech

Linking Rooms

Part of the Logic & Flow section of Coddy's Lua journey — lesson 25 of 54.

challenge icon

Challenge

Easy

Building on your starting room, create a second room and link both rooms together through their exits tables.

You are provided with the startingRoom variable from the previous challenge (Ancient Library).

Create a new room called gardenRoom with the following details:

  • name: "Secret Garden"
  • description: "A hidden garden with overgrown plants and a small fountain."
  • exits: An empty table

Link the two rooms by adding exits to both:

  • Add an exit from startingRoom going "east" that leads to gardenRoom
  • Add an exit from gardenRoom going "west" that leads back to startingRoom

Print the name of the starting room, then print the name of the room you reach by going east from the starting room, then print the name of the room you reach by going west from that room.

Expected Output Format:

Ancient Library
Secret Garden
Ancient Library

Try it yourself

local startingRoom = {
    name = "Ancient Library",
    description = "You find yourself in a dusty library filled with ancient books and scrolls.",
    exits = {}
}

print(startingRoom.name)
print(startingRoom.description)

All lessons in Logic & Flow