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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.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文件返回lua文件?_Lua_Coronasdk - Fatal编程技术网

如何从另一个lua文件返回lua文件?

如何从另一个lua文件返回lua文件?,lua,coronasdk,Lua,Coronasdk,我有一个菜单lua,当我选择类别中的一个(“songselect”lua)并返回菜单lua时,我得到了这个错误: Runtime error ...ocuments\corona projects\singingbeemenu\director.lua:151: attempt to call field 'unloadMe' (a nil value) stack traceback: [C]: in function 'unloadMe' ..

我有一个
菜单
lua,当我选择类别中的一个(“songselect”lua)并返回
菜单
lua时,我得到了这个错误:

Runtime error
        ...ocuments\corona projects\singingbeemenu\director.lua:151: attempt to
call field 'unloadMe' (a nil value)
stack traceback:
        [C]: in function 'unloadMe'
        ...ocuments\corona projects\singingbeemenu\director.lua:151: in function
 '_listener
" 这是我的一个类别
songselect.lua

module(..., package.seeall)
display.setStatusBar( display.HiddenStatusBar ) 
function new()
    local localGroup = display.newGroup()
    local tableView = require("tableView")
    local ui = require("ui")

    --------------------------------------------------------------------------
    local screenOffsetW, screenOffsetH = display.contentWidth -  display.viewableContentWidth, display.contentHeight - display.viewableContentHeight

    local songList
    local backBtn
    local detailScreenText


    local background = display.newRect(0, 0, display.contentWidth, display.contentHeight)
    background:setFillColor(0, 0, 0)


    local data = {}
    --iPad: setup a color fill for selected items
    local selected = display.newRect(0, 0, 50, 50)  --add acolor fill to show the selected item
    selected:setFillColor(67,141,241,180)  --set the color fill to light blue
    selected.isVisible = false  --hide color fill until neede

    -----------------------------------------------
    data[1] = {}
    data[1].title = "Crazy Song"
    data[1].subtitle = "by Bruno Earth"
    data[1].image = "note.png"

    data[2] = {}
    data[2].title = "Enter Sunman"
    data[2].subtitle = "by Mentalica"
    data[2].image = "note.png"

    local topBoundary = display.screenOriginY + 40
    local bottomBoundary = display.screenOriginY + 0

    songList = tableView.newList{
        data=data,
        default="listItemBg.png",
        over="listItemBg_over.png",
        top=topBoundary,
        bottom=bottomBoundary,
        callback = function( row )
            local g = display.newGroup()

            local img = display.newImage(row.image)
            g:insert(img)
            img.x = math.floor(img.width*0.5 + 6)
            img.y = math.floor(img.height*0.5)

            local title =  display.newText( row.title, 0, 0, native.systemFontBold, 16 )
            title:setTextColor(0,0,0)
            g:insert(title)
            title.x = title.width*0.5 + img.width + 6
            title.y = 30

            local subtitle =  display.newText( row.subtitle, 0, 0, native.systemFont, 14 )
            subtitle:setTextColor(80,80,90)
            g:insert(subtitle)
            subtitle.x = subtitle.width*0.5 + img.width + 6
            subtitle.y = title.y + title.height + 6

            return g
        end
     }

    local function scrollToTop()
        songList:scrollTo(topBoundary-1)
    end

    local navBar = display.newImage("navBar.png")

    navBar.x = display.contentWidth*.5
    navBar.y = math.floor(display.screenOriginY + navBar.height*0.5)

    local navHeader = display.newText("Song Lists", 0, 0, native.systemFontBold, 16)
    navHeader:setTextColor(255, 255, 255)
    navHeader.x = display.contentWidth*.5
    navHeader.y = navBar.y

    --Setup the back button
    local backToMenu = function(event)
        print (event.phase)

        if event.phase == 'ended' then
            print ("ok")
            director:changeScene(event.target.scene, "fade")
            print ("back!")

        end
    end

    backBtn = display.newImage("backButton.png")
    backBtn.x = math.floor(backBtn.width/2) + backBtn.width + screenOffsetW
    backBtn.y = navBar.y 
    backBtn.scene = "menu"
    backBtn:addEventListener("touch", backToMenu)
    --backBtn.alpha = 0

    local listBackground = display.newRect( 0, 0, songList.width, songList.height )
    listBackground:setFillColor(255,255,255)
    songList:insert(1,listBackground)

    return localGroup
end
lua中的
返回
方法不可能吗

有人能帮我解释一下我为什么会出错吗


提前感谢…

我收到了这个消息,我将我的
director.lua
更改为最新版本…

尝试解决您的问题