lua-users home
lua-l archive

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


Hi,

Rick Burton wrote:
> This code runs on Lua 5.1.1 and Kepler Lua 5.0.2
> 
> http://www.lua.org/pil/5.2.html#Vararg

PIL1 is written for Lua 5.0, but LuaJIT is based on Lua 5.1.

> function fwrite (fmt, ...)
>   return io.write(string.format(fmt, unpack(arg)))
> end

See:

  http://luajit.luaforge.net/luajit_features.html

under "Caveats":

  LuaJIT ships with LUA_COMPAT_VARARG turned off. I.e. the
  implicit arg parameter is not created anymore. Please have a
  look at the comments in luaconf.h for this configuration
  option. You can turn it on, if you really need it. Or better
  yet, convert your code to the new Lua 5.1 vararg syntax.

Please refer to the examples in PIL2 (the blue book, only
available in print right now), section 5.2:

function fwrite (fmt, ...)
   return io.write(string.format(fmt, ...))
end

Bye,
     Mike