lua-users home
lua-l archive

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


Hi Mike!

This code runs on Lua 5.1.1 and Kepler Lua 5.0.2

http://www.lua.org/pil/5.2.html#Vararg

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

fwrite("%s %d\n","Total is:", 5)
--------

But LuaJIT 1.1.2 fails

C:\LUA\BIN\LUAJIT.EXE: arg.lua:2: bad argument #2 to 'format' (string expected
, got no value)
stack traceback:
        [C]: in function 'format'
        arg.lua:2: in function 'fwrite'
        arg.lua:5: in main chunk
        [C]: ?

---------

Compiled on Win 98SE using latest Candidate GCC 3.4 MinGW and MSYS.

-- Rick