Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Lua Corona-无法将event.alert保存到GGData_Lua_Coronasdk - Fatal编程技术网

Lua Corona-无法将event.alert保存到GGData

Lua Corona-无法将event.alert保存到GGData,lua,coronasdk,Lua,Coronasdk,我使用的是这里的数据。它很有魅力。直到我想保存从notificationListener收到的event.alert。奇怪的是,当我像这样弹出事件native.showAlertTitle,event.alert,{Ok}。它将显示event.alert消息。但当我尝试将其保存到GGData时,如下所示: local function notificationListener( event ) -- display alert that shows the event name and

我使用的是这里的数据。它很有魅力。直到我想保存从notificationListener收到的event.alert。奇怪的是,当我像这样弹出事件native.showAlertTitle,event.alert,{Ok}。它将显示event.alert消息。但当我尝试将其保存到GGData时,如下所示:

local function notificationListener( event )
    -- display alert that shows the event name and type:
    print("init notificationListener")

    local yo = GGData:new("tuohai")
    yo:set("message",event.alert)
    yo:save()
end

它没有获取event.alert的值。为什么会这样

为了快速排除最常见的错误,您是否记得添加local GGData=require GGData?您是否可以尝试使用这个yo:setmessage,…event.alert已经声明本地GGData=requireGGData,但我还没有尝试yo.setmessage,…event.alert。。这似乎给了我们一些希望。我现在就要试试。我在执行此操作时出错了yo:setmessage,…event.alert,它试图将字段'alert'连接为nil值hmm,这意味着event.alert=nil-它不应该是。你能告诉我你在哪里声明侦听器吗?