How to create a widget.newPickerWheel (comes up as error "Attempt to index field '?' (a nil value)")

Getting the error “Attempt to index field ‘?’ (a nil value)”

on the line that says local pickerWheel = widget.newPickerWheel {

I’m not coding anything other than setting up this pickerWheel. Here is the full code of my main.lua file:

-- main.lua display.setStatusBar (display.HiddenStatusBar) system.setIdleTimer(true) local widget = require "widget" print("START OF APP") widget.setTheme( "widget\_theme\_ios") -- or --widget.setTheme( "widget\_theme\_android") -- Create two tables to hold data local time = {} local interval = {} -- Populate the "time" table for d = 1, 12 do time[d] = d end -- Populate the "minutes" table for y = 0, 3 do interval[y] = y \* 15 end -- Configure the picker wheel columns local columnData = { -- Hour { align = "right", width = 140, startIndex = 10, labels = time }, -- Minutes { align = "center", width = 60, startIndex = 0, labels = interval }, -- AM/PM { align = "center", width = 80, startIndex = "AM", labels = { "AM", "PM" } } } -- Create the widget local pickerWheel = widget.newPickerWheel { top = display.contentHeight - 222, columns = columnData } -- Get the table of current values for all columns -- This can be performed on a button tap, timer execution, or other event local values = pickerWheel:getValues() -- Get the value for each column in the wheel (by column index) local currentMonth = values[1].value local currentDay = values[2].value local currentYear = values[3].value print( currentMonth, currentDay, currentYear )

The problem is with the startIndex. It must be a number between 1 and total number of elements of the column data.

Thank you! It was a problem with startIndex.

The problem is with the startIndex. It must be a number between 1 and total number of elements of the column data.

Thank you! It was a problem with startIndex.