Class std.strbuf
String buffers.
Prototype Chain
table `-> Object `-> StrBuf
Objects
std.strbuf.StrBuf | StrBuf prototype object. |
Functions
std.strbuf.concat (s) | Add a string to a buffer. |
std.strbuf.tostring () | Convert a buffer to a string. |
Metamethods
std.strbuf:__concat (buffer, s) | Support concatenation to StrBuf objects. |
std.strbuf:__tostring (buffer) | Support fast conversion to Lua string. |
Objects
- std.strbuf.StrBuf
-
StrBuf prototype object.
Set also inherits all the fields and methods from std.object.Object.
Fields:
- _type string object name (default "StrBuf")
See also:
Usage:
local std = require "std" local StrBuf = std.strbuf {} local buf = StrBuf {"initial buffer contents"} buf = buf .. "append to buffer" print (buf) -- implicit `tostring` concatenates everything os.exit (0)
Functions
Methods- std.strbuf.concat (s)
-
Add a string to a buffer.
Parameters:
- s string string to add
Returns:
-
StrBuf
modified buffer
Usage:
buf = concat (buf, "append this")
- std.strbuf.tostring ()
-
Convert a buffer to a string.
Returns:
-
string
stringified
buf
Usage:
string = buf:tostring ()
Metamethods
- std.strbuf:__concat (buffer, s)
-
Support concatenation to StrBuf objects.
Parameters:
Returns:
-
StrBuf
modified buf
See also:
Usage:
buf = buf .. str
- std.strbuf:__tostring (buffer)
-
Support fast conversion to Lua string.
Parameters:
- buffer StrBuf object
Returns:
-
string
concatenation of buffer contents
See also:
Usage:
str = tostring (buf)