Advance the printmaking queue
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.
Understand it, then try it.
A printmaker keeps the next jobs in a sequence table. Read its first entry before removing it, so the program can report both the completed job and the new first job. table.remove closes the gap by shifting later entries down. The saved local variable still contains the original first string.
local jobs = {"sketch", "ink", "frame"}local finished = jobs[1]table.remove(jobs, 1)print(finished .. " -> " .. jobs[1])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.
Track the values line by line. Predict the result before running this example in your own editor.