Thanks for your help, but I still can’t get it to work.
This is my code in the configuration menu. Im sorry for the spanish variables.
module(..., package.seeall) local widget = require( "widget" ) local datos = require( "datos\_configuracion" ) function new() -- Set the default value local wheel\_index = 2 if datos.wheel\_index == nil then print("There's nothing stored in the variable", datos.wheel\_index) else wheel\_index = datos.wheel\_index print("Sets the index to the value stored") end local w,h = display.contentWidth, display.contentHeight local aceptar = display.newText("Aceptar",0,0,nil,16) aceptar:setReferencePoint(display.CenterReferencePoint); aceptar.x = \_w-40; aceptar.y = \_h+20; local localGroup = display.newGroup() local number\_players = {} -- Populate the days table for i = 1, 4 do number\_players[i] = i end --print("la cantidad de jugdores que hay son," cantidad\_jugadores.getn(a)) -- Set up the Picker Wheel's columns local columnData = { { align = "center", width = 290, labels = number\_players, startIndex = wheel\_index } } -- Create a new Picker Wheel local pickerWheel = widget.newPickerWheel { top = display.contentHeight - 0, font = native.systemFontBold, columns = columnData, } function changeScene(e) if(e.phase == "ended") then director:changeScene(e.target.scene, "moveFromRight"); end end function Back(e) if(e.phase == "ended") then localGroup.remove(pickerWheel) director:changeScene(e.target.scene, "moveFromLeft"); display.remove( pickerWheel ) pickerWheel = nil end end function show\_picker() transition.to( pickerWheel, { time=300, x= 0, y=(h - 222)} ) transition.to(aceptar,{ time=300, x= w-40, y=(h - 240)}) end function ocultar\_picker() --guarda el valor del picker en la variable global datos local selectedRows = pickerWheel:getValues() for i=1,#selectedRows do datos.wheel\_index = selectedRows[i].value print ("se ha guardado el valor en datos: ", selectedRows[i].value) end transition.to( pickerWheel, { time=300, x= 0, y=h+222} ) transition.to( aceptar, { time=300, x= w-40, y=h+240} ) localGroup.remove(pickerWheel) end aceptar:addEventListener("tap", ocultar\_picker); local label\_jugadores = display.newText("Numero de Jugadores", 0, 0, native.systemFont, 16) label\_jugadores:setReferencePoint(display.CenterReferencePoint); label\_jugadores.x = \_w/2; label\_jugadores.y = \_h/2-90; label\_jugadores:addEventListener("tap", show\_picker); local creditos = display.newText("Créditos", 0, 0, native.systemFont, 16) creditos:setReferencePoint(display.CenterReferencePoint); creditos.x = \_w/2; creditos.y = \_h/2-40; creditos.scene = "configuracion"; creditos:addEventListener("tap", changeScene); --local aceptar = display.newText("Aceptar", 0, 0, native.systemFont, 16) local volver = display.newText("Atrás", 0, 0, native.systemFont, 16) volver:setReferencePoint(display.CenterReferencePoint); volver.x = \_w/2; volver.y = \_h/2-140; volver.scene = "menu"; volver:addEventListener("touch", Back); --- insert everything into the localGroup localGroup:insert(label\_jugadores) localGroup:insert(creditos) localGroup:insert(volver) localGroup:insert(aceptar) -- clean everything up clean = function () end -- do not remove lest the sky shalt fall upon thine head return localGroup end