mascarenhas / alien

A C FFI for Lua
http://mascarenhas.github.com/alien/
143 stars 45 forks source link

Improve implementation of strlen & size of buffer #31

Closed rrthomas closed 12 years ago

rrthomas commented 12 years ago

This series of commits renames buffer's "size" field to a __len metamethod for simplicity of use, renames its "len" method to "strlen" for clarity, and bumps the version to 0.7.0 (because the change is backwards incompatible).

Ideally, arrays would also have a len metamethod, but this is not possible in Lua 5.1, where tables can't have a len metamethod; I've already put in a FIXME to change this when Lua 5.1 support is dropped.

This set of changes enables use of raw memory buffers with the upcoming lrexlib 2.7.