使用lua语言在corana中循环或以前的错误加载模块

时间:2016-04-15 05:59:42

标签: lua

我需要帮助才能解决问题。我真的不知道为什么会出现这种错误。 我使用此代码为我的最后一年项目开发旅游应用程序。请帮我解决这个问题



local accomodation = require( "accomodation")
local function onComplete( event )
	local action = event.action
	if "clicked" == event.action then
		if 2 == event.index then
			-- Open url if "Learn More" was clicked by the user
			system.openURL( "http://www.trivago.com.my/?iPathId=74807&iGeoDistanceItem=0&aDateRange%5Barr%5D=2016-04-17&aDateRange%5Bdep%5D=2016-04-18&iRoomType=7&cpt=7480703&iViewType=0&bIsSeoPage=false&bIsSitemap=false&" )
		end
	elseif "cancelled" == event.action then
		-- our cancelAlert timer function dismissed the alert so do nothing
	end
end

-- Show alert
local alert = native.showAlert( "GoPenang", "You will be directed to trivago.com", { "Cancel", "Ok" }, onComplete )

-- Dismisses alert after 10 seconds
local function cancelAlert()
	native.cancelAlert( alert )
end

function scene:createScene(event)
   local group = self.view
   end
function scene: enterScene(event)
    local group = self.view
	end
function scene:exitScene(event)
local group = self.view
end
function scene:destroyScene(event)
local group = self.view
end

timer.performWithDelay( 10000, cancelAlert )

scene:addEventListener("createScene", scene)
scene:addEventListener("enterScene", scene)
scene:addEventListener("exitScene", scene)
scene:addEventListener("destroyScene",scene)
return scene




这是我的住宿代码。错误将显示如下: enter image description here

1 个答案:

答案 0 :(得分:0)

错误消息表明它无法加载“accomodation”模块。我不知道那个模块是做什么的,但是在你编写的第一行

local accomodation = require( "accomodation")

这段代码试图加载住宿模块 - 你似乎永远不会在发布的代码中的任何地方使用它。尝试删除该行并查看后面的内容。