Jump to content
Phishing Emails & YouTube Messages - Fake Giveaway Read more... ×
Search In
  • More options...
Find results that contain...
Find results in...

Lua module not found

Recommended Posts

Posted · Original PosterOP

Hey guys I'm getting an error when I try to press a button in my "app" that is supposed to begin running the code on another .lua file called level1.lua but it is giving these errors.

the code it is referring to is 


local playBtn

-- 'onRelease' event listener for playBtn
local function onPlayBtnRelease()
	-- go to level1.lua scene
	composer.gotoScene( "level1", "crossFade", 500 )
	return true	-- indicates successful touch


But it is saying that the module is not found. Any ideas?


Edit I figured that out now I have this error. I had multiple test prints and it seems to be failing somehow between the end scene:create and start of scene:show


11:57:09.015  testing
11:57:09.015  testing2
11:57:09.015  testing3
11:57:09.015  ERROR: Runtime error

11:57:09.015  ?:0: attempt to index field 'from' (a nil value)
11:57:09.015  stack traceback:
11:57:09.015      ?: in function 'gotoScene'
11:57:09.015      C:\Users\Charles\Documents\Corona Projects\Powell Animation\menu.lua:15: in function '_onRelease'
11:57:09.015      ?: in function '?'
11:57:09.015      ?: in function '?'
11:57:09.015      ?: in function <?:190>

Those functions call this file


-- code.lua

local composer = require("composer")
local scene = composer.newScene()

--include physics 
local physics = require "physics"

--Shortcut local variables
local screenW, screenH, halfW = display.actualContentWidth, display.actualContentHeight, display.contentCenterX

function scene:create(event)
	local sceneGroup = self.view
	print "testing"
	--start physics

	--Creates the background with color
	local background = display.newRect(display.screenOriginX,display.screenOriginY,screenW,screenH)
	background.anchorX = 0
	background.anchorY = 0
	print "testing2"

	local spaceship = display.newImageRect("Sunglasses_Emoji.png",90,90)
	spaceship.x,spaceship.y = 160, -160
	physics.addBody(spaceship, {density =2.0, friction = 0.0, radius = 30})

	--create 8 obstacles

	print "testing3"


function scene:show(event)
		print "testing4"

	local sceneGroup = self.view
	local phase = event.phase

	if phase == "will" then
	elseif phase == "did" then
		--Add my animation here
		--perhaps two ships moving through asteroid objects


function scene:hide(event)
	local sceneGroup = self.view
	local phase = event.phase

	if phase == "will" then
		--when code is on screen
	elseif phase == "did" then
		--code here runs when whole scene is off screen


function scene:destroy( event )
    local sceneGroup = self.view
    -- Code here runs prior to the removal of scene's view

    package.loaded[physics] = nil
	physics = nil

scene:addEventListener( "hide", scene )
scene:addEventListener( "destroy", scene )

return scene



i5 4670k| Asrock H81M-ITX| EVGA Nex 650g| WD Black 500Gb| H100 with SP120s| ASUS Matrix 7970 Platinum (just sold)| Patriot Venom 1600Mhz 8Gb| Bitfenix Prodigy. Build log in progress 

Build Log here: http://linustechtips.com/main/topic/119926-yin-yang-prodigy-update-2-26-14/

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now