lua-users home
lua-l archive

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


In struct  library , option `s` means read a zero-terminated string.So the same test is
local struct = require 'struct'
print(struct .unpack('s', 'ABC'))

Dirk Laurie <dirk.laurie@gmail.com> 于2018年9月3日周一 下午6:23写道:
Op Ma., 3 Sep. 2018 om 12:08 het actboy168 <actboy168@gmail.com> geskryf:
>
> But the struct library will raise an error.

True, but that error is:
   bad argument #1 to 'unpack' (invalid format option 'z')
I.e. the option 'z' is an addition available in the Lua 5.3 library version.



-- actboy168