lua-users home
lua-l archive

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


Martin wrote:
> If  I do:
> require('std')
> print(string.format("The %s is %d", "answer", 42)
> 
> in luajit I get the output
> The %s is %d
> 
> but if I do not require('std')
> then output is as expected

Apparently stdlib has not been updated to use Lua 5.1 semantics
regarding varargs. And LuaJIT does not have the Lua 5.0 vararg
backwards compatibility enabled by default.

Anyway, stdlib has some strange code like:
  if #arg == 0 then ...
Which is mixing Lua 5.1 syntax (# operator) and Lua 5.0 syntax
(arg table).

There's more ugliness inside like an __index function for the
string metatable, overriding lots of standard functions and in
general adding lots of bloat. So I suggest to stay away from it.

--Mike