Color theme
0 day streak0 XPP1
LuaQuiz mode
MISSION 1 OF 3

Insert a fabric swatch

0 XP earned
Lua track: BeginnerMission: BeginnerSequence tablesInsertionOne-based indexes
Before you start this beginner track

Variables, loops, and sequences. Lua sequence indexes start at one.

Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.

x
0 / 6 challenges
KNOWLEDGE CHECK

Predict the result.

What is the final fabric inventory?

workshop.lua
local fabrics = {"linen", "wool"}table.insert(fabrics, 2, "silk")local inventory = table.concat(fabrics, ", ")print(inventory)

Each mission is a standalone Lua 5.4 script with standard libraries. Tables used as sequences have consecutive integer keys starting at 1 and no gaps. All string examples use ASCII text.

Review the lesson

Lua uses tables for ordered sequences as well as other data structures. table.insert can place a new item at a chosen position and shift later items along. The sequence begins at position 1. table.concat joins these string values into a readable inventory while preserving their order.

Choose your answer+25 XP on first completion