lua-users home
lua-l archive

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


I remember reading on the mailing list a while back that Lua
3.1 was possibly going to make strings non null terminated so
they could contain nulls.  

I'm writing a way to code up GPIB drivers for our lab devices
in lua, and some devices return null characters in data.  I was
contemplating writing my own block-of-bytes data structure but
since I figured it would be in the next version I'd just wait.

Will the implementation in lua still null terminate strings for
compatibility's sake?  And will there be new API commands to
get and push lua strings for the non null terminated strings?

Another thing is that I noticed that in lua when lua_getstring()
is called, it seems to make a copy of the string that is retrieved,
even if that string is in a variable that is passed as a parameter.
I tried to change the value of a string by directly writing to
the string but the changes do not take effect.  Is this true,
and if so, will there be a way to retrieve strings by reference,
so they don't have to be copied (and possibly could be modified
in place?).  Some strings would be rather long, and it would
good to avoid copying them excessively, and also it would be useful
to use a string as preallocated space to store information.

Dan Marks
dmarks@uiuc.edu