|
Am 21.09.2014 um 04:45 schröbte Ashish Ranjan:
FEATURE REQUEST: In python , we have a construct if __name__ == “__main__”: so that if a module .lua file is executed by itself then this code block executes, but if this module is imported(required() as in lua) by other script file, then this code blosk is not executed. Can we have this construct in lua. This will be an important step in life of a lua module.
Can already be done, e.g. like this[1]. I don't like the idea of an extra special upvalue, and the chunk arguments are already used in both cases ...
Ashish Ranjan ashishwave@yahoo.com
Philipp[1]: https://github.com/siffiejoe/lua-amalg/blob/master/src/amalg.lua#L233-L253