A Fuse Powered Company

Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

mte.cleanup() error - attempt to index global 'mte' (a nil value)
Started by adam.qwan Feb 10 2014 02:32 PM

5 replies to this topic
mte
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

adam.qwan

[GLOBAL: userInfoPane.html]
adam.qwan
  • Starter
  • PipPip
  • 22 posts
  • Member

 Hi,

 

I am new to MTE and I wanted to use the mte.cleanup() function in the 'Platformer - Basic PHYSICS 0v958' sample to remove the map during storyboard's exitscene (I tried it in destroyscene as well).  regardless, i get a runtime error: attempt to index global 'mte' (a nil value).

 

I've used the sample code as the skeleton and have only added the needed storyboard elements to test this, but i can't seem to get around this error.  are there any known bugs with the cleanup function?  Is there a working example or sample code I could use to resolve the error?  i followed the other storyboard sample as a template, but could not get cleanup to work with the Platformer - Basic PHYSICS sample.

 

super thanks in advance!



[TOPIC: post.html]
#2

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Starter
  • PipPipPipPipPipPip
  • 587 posts
  • Jedi

Hello Adam,

 

Cleanup can cause problems depending on when and how you use it. For example you have to be careful not to call cleanup if mte.update() might be executing. I'll look into it on my end, but I'll need to know which lines of code are throwing the error.



[TOPIC: post.html]
#3

adam.qwan

[GLOBAL: userInfoPane.html]
adam.qwan
  • Starter
  • PipPip
  • 22 posts
  • Member

Thank you for taking a look!  I have a screenshot of the runtime error output, but i don't know how useful it is.

 

https://docs.google.com/file/d/0Bz__-sNpkRsXOENNaXpGVUJDWHc/edit?pli=1

 

my code is pretty simple and i've commented out pretty much everything but loading the map to try and troubleshoot.  I use widget candy buttons to kick off the scene change.  I've used them in the past, they are being removed properly when i comment out MTE.

 

455    --MTE CLEANUP
456          
457    Runtime:removeEventListener("enterFrame", gameLoop)        
458    mte.cleanup()
 
let me know if you aren't able to reproduce the error, that would be a good sign that i'm making a mistake somewhere.  Many thanks!!!


[TOPIC: post.html]
#4

dyson122

[GLOBAL: userInfoPane.html]
dyson122
  • Starter
  • PipPipPipPipPipPip
  • 587 posts
  • Jedi

I've sent you a PM. I can't reproduce the problem on my end, but that doesn't mean a problem doesn't exist. I'd like you to email your project to me if possible. This way I'll have the original error right in front of my face and the means to debug it.



[TOPIC: post.html]
#5

adam.qwan

[GLOBAL: userInfoPane.html]
adam.qwan
  • Starter
  • PipPip
  • 22 posts
  • Member

Just sent you my project.  Thank you for the awesome support!  I'm very grateful for your help.  



[TOPIC: post.html]
#6

adam.qwan

[GLOBAL: userInfoPane.html]
adam.qwan
  • Starter
  • PipPip
  • 22 posts
  • Member

Thank you for the awesome support!  

 

In case any other newbies like me run into this problem, I made the mte variable local when it should not have been:

 

You've made the mte variable local to the scene:createScene event, and so the scene:exitScene event has no idea what you're talking about when you call mte.cleanup(). You can solve the problem by declaring the variable outside the events, such as just below the require statement for storyboard.
 
 
---------------------------------------------------------------------------------
--
-- LEVEL1.LUA
--
---------------------------------------------------------------------------------
 
    -- REQUIRE STORYBOARD
    local storyboard = require( "storyboard" )
    local scene = storyboard.newScene()
    local mte                                 
 
----------------------------------------------------------------
-- CREATE THE SCENE (WHEN THE SCENE'S VIEW DOES NOT EXIST)
----------------------------------------------------------------
function scene:createScene( event )
    local group = self.view
        
    -- HIDE STATUS BAR
    display.setStatusBar( display.HiddenStatusBar )
 
    -- TEXTURE FILTER
    display.setDefault( "magTextureFilter", "nearest" )
    display.setDefault( "minTextureFilter", "nearest" )
 
    --ENABLE MULTITOUCH
    system.activate( "multitouch" )
 
    -- REQUIRE MTE
    mte = require("MTE.mte")



[topic_controls]
[/topic_controls]



Also tagged with one or more of these keywords: mte