Breaking apart a project?

I was wondering. I’ve been building a project and I wanted to see if I can separate out some code that I might want to use later in other projects.

So in my case, I’ve made an on-screen control, and it’s a lengthy blob of code that loads images and positions things into a display group. I’d like to maybe reuse this, and move it to a separate file called “conrtoller.lua”. Any tips on how to do this? Do I look into modules that I require? I’ve been looking around and I can’t really seem to find a simple explanation.

Thanks [import]uid: 100618 topic_id: 32064 reply_id: 332064[/import]

Hi @dower,
Modulizing it makes sense. If you need a crash course in modules see this tutorial:

http://www.coronalabs.com/blog/2011/09/05/a-better-approach-to-external-modules/

As indicated within, avoid the module(..., package.seeall) method that still lingers around in some code examples. This has been depreciated in Lua itself and should be avoided.

Best of luck,
Brent [import]uid: 9747 topic_id: 32064 reply_id: 127788[/import]

Thanks Brent, I’ll take a look at that link! [import]uid: 100618 topic_id: 32064 reply_id: 127804[/import]

Hi @dower,
Modulizing it makes sense. If you need a crash course in modules see this tutorial:

http://www.coronalabs.com/blog/2011/09/05/a-better-approach-to-external-modules/

As indicated within, avoid the module(..., package.seeall) method that still lingers around in some code examples. This has been depreciated in Lua itself and should be avoided.

Best of luck,
Brent [import]uid: 9747 topic_id: 32064 reply_id: 127788[/import]

Thanks Brent, I’ll take a look at that link! [import]uid: 100618 topic_id: 32064 reply_id: 127804[/import]