lua-users home
lua-l archive

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


> If Lua represents a string as a contiguous sequence of bytes then an
> "excerpt" of the right size (4 bytes, say) would contain the same byte
> values as a machine integer, so there wouldn't be a problem from the C
> point of view. I see what you mean, though - we shouldn't rely on a
> particular implementation of a string (they might use rope structures or
> something in Lua 6). There would need to be routines in the Lua C API to
> retrieve the raw byte sequence from a string as an integer, float or
> whatever.

The Lua core does see strings as raw sequences of bytes. There is no
"particular implementation" involved. This is not an implementation
detail, but part of the specification.

-- Roberto