module(..., package.seeall) still in effect?

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

I’m stuck wondering about the libraries I’m already using, that originally came with Corona SDK.

From what I’m gathering, the module(…, package.seeall) is deprecated, yet many default libraries still come with it.

Here’s two:

local ui = require("ui")  
local tableView = require("tableView")  

Does this mean I should rewrite anything with module(…, package.seeall), including these libraries?

I’d love to start writing my own classes/modules, but I feel I’m getting mixed messages.

[import]uid: 154122 topic_id: 31245 reply_id: 331245[/import]

These aren’t default libraries - defaults are the ones built into corona (ie: math.*)

The libraries you mention are basically tutorial libs provided by devs (or sometimes, users) that Corona included (you’ll notice the install also includes a bunch of tutorial and demo code)

In terms of best practice, yes, you should move towards not using the module line. It’s deprecated in Lua itself but is still supported in Corona (which is an implementation of Lua, but obviously has to run at its own pace) AFAIK.

Avoiding .seeall will help you avoid a variety of memory leak situations but many of the dev provided libraries are pretty solid and have been used for shipped code before, those two included. I wouldn’t avoid the approach like the plague, but maybe gently ask the author for an update. :wink: (tableView has been replaced by newTableView in the widget.* library, for instance)

The two approaches can definitely coexist, so write your own using the new method. (ie: I write using the new approach,but there are some tools like Lime that are thoroughly engrained using the old one)

tl;dr try to spend your time writing code for your project and not so much time rewriting other people’s modules. You’ll enjoy coding more that way :slight_smile: [import]uid: 41884 topic_id: 31245 reply_id: 125006[/import]

These aren’t default libraries - defaults are the ones built into corona (ie: math.*)

The libraries you mention are basically tutorial libs provided by devs (or sometimes, users) that Corona included (you’ll notice the install also includes a bunch of tutorial and demo code)

In terms of best practice, yes, you should move towards not using the module line. It’s deprecated in Lua itself but is still supported in Corona (which is an implementation of Lua, but obviously has to run at its own pace) AFAIK.

Avoiding .seeall will help you avoid a variety of memory leak situations but many of the dev provided libraries are pretty solid and have been used for shipped code before, those two included. I wouldn’t avoid the approach like the plague, but maybe gently ask the author for an update. :wink: (tableView has been replaced by newTableView in the widget.* library, for instance)

The two approaches can definitely coexist, so write your own using the new method. (ie: I write using the new approach,but there are some tools like Lime that are thoroughly engrained using the old one)

tl;dr try to spend your time writing code for your project and not so much time rewriting other people’s modules. You’ll enjoy coding more that way :slight_smile: [import]uid: 41884 topic_id: 31245 reply_id: 125006[/import]