News for hackers. Stuff that matters.
Re:[ANN] Lua 5.2.0 (final) now available by Avshalom on Friday December 16, 2011 @10:49PM (#3363315)
So now that module(...) is deprecated does anyone know the expected standard pattern? The changes say to just build it with code (setting _ENV?) but do the devs have a "right way" to do it?
Re:[ANN] Lua 5.2.0 (final) now available by LeafStorm on Friday December 16, 2011 @11:12PM (#3363355)
The Lua developers are generally not very fond of endorsing a single "right way" to do things. But basically, it's something like:

    -- localize all the stuff you need
    local _ENV = {}
    -- module code
    return _ENV
So really not that much code to add yourself.
Re:[ANN] Lua 5.2.0 (final) now available by compay on Saturday December 17, 2011 @08:02AM (#3364166)
An easy way is to just define your functions in a table, and at the end of the file to be required, return the table. This was the pattern used in Lua before 5.1. The source for Luacov provides a clear example:

https://github.com/keplerproject/luacov/blob/master/src/luac...