我在menu.lua中有这个 local db = require "databaseconnection"...local function onEndBtnRelease() local thisandthat = db.getLoggedIn() native.showAlert( "Corona SDK", thisandthat.." teststring", { "OK" } )end... 这在databaseconnection
local db = require "databaseconnection"
...
local function onEndBtnRelease()
local thisandthat = db.getLoggedIn()
native.showAlert( "Corona SDK", thisandthat.." teststring", { "OK" } )
end
...
这在databaseconnection.lua中
local function getLoggedIn()
print("Test")
--[[...
]]--
return "some data"
end
我唯一想要的是来自getLoggedIn()的String(“some data”),但我得到的只是一个错误:
…\corona\menu.lua:51:attempt to call field ‘getLoggedIn’ (a nil value)
永远不会达到外包.
我正在使用Corona SDK和Sublime,来自isLoggedIn()的所需数据来自sqlite-request.我怎样才能达到这个功能?
local M = {}
function M.getLoggedIn()
print("Test")
--...
return "some data"
end
return M
请注意,该函数需要是非本地的,或者它是私有的.
有关其他高级方法,请参阅PiL.
