Table entries can have names instead of positions. stock.bolts reads the value stored under bolts; stock.lamps reads a different entry.
Read and display the numeric lamp stock, 2.
2
Lines must stay in order. Spelling, capitalization and spaces inside a message matter.
local score = { red = 5, blue = 8 }
print(score.blue)The named field blue holds 8.
New syntax: { bolts = 3 }, .bolts
Inside this table, bolts = 3 names one field and gives it a value. A dot followed by its name reads that field. This is a local learning inventory for one run.
Select a word or symbol in this authored example. Your editor draft stays unchanged.
stock bolts 3, lamps 2
stock.boltsThis is a private experiment copy. It does not replace your answer or complete the activity.
Your output will appear here.
Replace this code with the starter? Download your draft to keep a copy.
Your output will appear here.
Sign in with RoCreators to save private progress across devices. Community verification is separate.