lua-users home
lua-l archive

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


Dear All,

I am trying to output a numeric value using in a 4digit hexadecimal format in the following way:
" io.write(string.format("%04x", printchars)) "

I am getting an error as follows:

./pulse_parser.lua 2012-08-16
/usr/bin/lua: ./pulse_parser.lua:16: bad argument #2 to 'format' (integer expected, got number)
stack traceback:
        [C]: in function 'format'
        ./pulse_parser.lua:16: in function 'printwc'
        ./pulse_parser.lua:32: in function 'wc'
        ./pulse_parser.lua:45: in main chunk
        [C]: ?

Can you please help me in finding a workaround with this?

I am running Lua on an OpenWRT device and Lua version is "Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio (double int32)"

I would like also to point out that everything works fine on my Ubuntu machine running "Lua 5.0.3  Copyright (C) 1994-2006 Tecgraf, PUC-Rio"

Thank you in anticipation,

Best Regards,

Edward Scerri