Menu
Coddy logo textTech

Project: The Task Shape

Part of the Introduction To Luau section of Coddy's Lua journey — lesson 45 of 73.

challenge icon

Challenge

Easy

Lay the foundation of the task manager.

Define a type alias named Task describing a table with:

  • id of type number
  • title of type string
  • done of type boolean

Create a typed array named tasks of type {Task} containing, in order:

  • id 1, title "Learn Luau types", done false
  • id 2, title "Build a task manager", done false
  • id 3, title "Write tests", done true

Then print, each on its own line:

  1. the first task's id
  2. the first task's title
  3. the first task's done flag
  4. how many tasks there are (use #)

Try it yourself

-- Write code here
-- 1) define type Task = {id: number, title: string, done: boolean}
-- 2) create tasks: {Task} with the three starter tasks
-- 3) print the first task's id, title and done flag, then the task count

All lessons in Introduction To Luau