lua-users home
lua-l archive

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


lua_bufflib is a library for string buffers in Lua.

lua_bufflib lives on GitHub[1], with documentation at [2]. It can be
installed with `luarocks install lua_bufflib` (it may take some time
before this version is uploaded to the rocks server).

Version 0.2 adds support for calling string methods on Buffers by
prefixing the name with "s_". For example, `bufflib.s_gsub(buff, ...)`
and `buff:s_gsub(...)` are both equivalent to `str:gsub(...)` (where
`buff` is a Buffer and `str` is the Buffer's contents as a string).

All functions from the global "string" table can be called like this,
not just the ones defined by the string library.

Note that the library makes no attempt to determine whether or not the
string function should even be called with a string as the first
argument; so `buff:s_dump()` can be called, but it will probably throw
an error when calling `string.dump` with a single string argument.

I've attached the rockspec, which can be used to install the new
version before it's uploaded to the rocks server.

Regards,
Choonster

[1] https://github.com/Choonster/lua_bufflib
[2] http://choonster.github.io/lua_bufflib/

Attachment: lua_bufflib-0.2.0-1.rockspec
Description: Binary data