Modules - why doesnt this work?

Main.lua:

ourModule = require ("ourModule");

ourModule.lua

module(..., package.seeall);

print(mainVariable);

Problem: the variable set in main.lua is not printed in the module

I'm really struggling with Modules - do people generally use them? How on earth do you work with scope between them?

Thanks

Tom

Well there are two primary ways of getting data into a module.

1. Pass it as a parameter.

1
2
3
module = require("module")
 
module.new(myvariable)
views:1544 update:2011/9/27 18:14:54
corona forums © 2003-2011