Hello,
I’m trying to implement a Slider widget into my Director program. To test it, I used this code from the WidgetDemo:
-- slider listener function
local function sliderListener( event )
local string = "Slider at " .. event.value .. "%"
sliderResult:setText( string )
sliderResult:setReferencePoint( display.CenterReferencePoint )
sliderResult.x = 160
sliderResult.y = 150
end
local slider = widget.newSlider{
top = 200,
left = 50,
listener = sliderListener
}
sliderGroup:insert( slider )
When I try to run the program, I get this error:
…\options.lua:86: ERROR: table expected. If this is a function call, you might have used ‘.’ instead of ‘:’
Does anyone know how to fix this? The code runs fine when I simulate the WidgetDemo. localGroup is the parent group of sliderGroup (I used “local sliderGroup = display.newGroup(); local localGroup = display.newGroup(); localGroup:insert( sliderGroup )”)
(Line 86 is sliderGroup:insert( slider )) [import]uid: 151029 topic_id: 27118 reply_id: 327118[/import]