alien
alien copied to clipboard
Allow (NUL-terminated) array of chars inside a def_struct
Example:
SMsgError = alien.defstruct{ {"cmdLen", "ulong"}, {"cmd", "ulong"}, {"deviceType","byte"}, {"deviceNo","byte"}, {"errNo","short"}, {"errStr", "char",256}, {"errType","byte"} } Note the optional third element in the struct´s definition.
Now you can:
local instance=SMsgError:new()
instance.errStr="This is a severe error..."
errStr is padded with NUL-bytes. You can also
print( instance.errStr )