|
Better to not muck with environments at all. The following works just fine in Lua 5.1 and 5.2:
If you insist on mucking with the global environment, you can always add: _G[ ... ] = M People sometimes prefer to write all of the functions as locals and end with: return { exportedFunction1 = exportedFunction1, exportedFunction2 = exportedFunction2, exportedFunction3 = exportedFunction3 } This allows you to see all of the exports in one place but it also requires writing the names twice. If you don't trust your spelling, you can help a bit by wrapping the right-hand sides in asserts (or using a lint that hunts for global reads). Mark |