Reading an entry that is not in a table gives nil. That means no value is present; it is different from a stored count of zero.
Add a lamps field with the number 0 so the existing print displays 0 instead of nil.
0
Lines must stay in order. Spelling, capitalization and spaces inside a message matter.
local stock = { keys = 0 }
print(stock.maps)There is no maps entry, so its value is nil.
New syntax: nil
This table has bolts but no lamps field. print(stock.lamps) displays nil. Adding lamps = 0 creates a field with a numeric value of zero.
Select a word or symbol in this authored example. Your editor draft stays unchanged.
stock bolts 3
stock.lampsThis 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.