lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> [1/4] Add -u flag to interpreter. Forces unbuffered standard streams.
> This idea is calqued from the Python interpreter's own -u flag of the
> same purpose and implementation, and is useful for prompt output in
> situations where a Lua script's output is executed in a batch context
> and/or its output piped into another program. In that case Glibc
> automatically decides to buffer by blocks, making the output fail to
> appear promptly (or at all, should the program be killed).
> 
> Although this can be solved by :setvbuf("no"), much as in Python it's
> very handy to have that as a single-letter flag.

You can define a file 'u.lua' in your path with this code:

 io.stdin:setvbuf("no")
 io.stdout:setvbuf("no")
 io.stderr:setvbuf("no")

Once you do that, you now have a two-letter flag "-lu".


> [2/4] Allow renaming main() function of Lua interpreter. In case Lua
> is embedded within a larger program, the following allows redefining
> the C function name main() to something else through the preprocessor.
> One useful application of this is to combine lua and luac in one
> binary that dispatches on argv[0]. This is generally smaller than lua
> and luac separately due to code sharing.

As already answered, this motivation seems weak. Anyway, you can
add something like

  #if defined(lua_c)
  #define main main_lua
  #endif

to 'luaconf.h' to have a similar effect.


> [3/4] Put one searcher per line. Although this appears purely
> cosmetic, this array is an obvious target for patching, and currently
> requires a +1-1 diff even for an addition. By spreading the array one
> entry per line, an addition at any position in the array can be made
> with a +1 diff only, reducing the chance of conflicts.

That is nice :-)


> [4/4] Add a dummy static searcher, and its entry in the searcher table
> modified according to patch 3. This reduces the size of a diff that
> adds statically-linked packages, and serves as a constructive example
> of adding a new searcher.

Again, that seems too specific. Constructive examples seem better
served by appropriate documentation.

-- Roberto