aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-10-23 11:10:19 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-10-23 11:10:19 -0300
commitb93f3b00bb76cddbf600eb399849fb0c01d197fd (patch)
tree0956d95c1485780a89f759b83e5f4f51dd4ab523
parent4c32d9300c77a70b7c20b2eebda40e97541e3f01 (diff)
downloadlua-b93f3b00bb76cddbf600eb399849fb0c01d197fd.tar.gz
lua-b93f3b00bb76cddbf600eb399849fb0c01d197fd.tar.bz2
lua-b93f3b00bb76cddbf600eb399849fb0c01d197fd.zip
Added function 'luaL_buffsub'
-rw-r--r--lauxlib.h2
-rw-r--r--manual/manual.of26
2 files changed, 19 insertions, 9 deletions
diff --git a/lauxlib.h b/lauxlib.h
index c50cdf4d..b34b3805 100644
--- a/lauxlib.h
+++ b/lauxlib.h
@@ -185,6 +185,8 @@ struct luaL_Buffer {
185 185
186#define luaL_addsize(B,s) ((B)->n += (s)) 186#define luaL_addsize(B,s) ((B)->n += (s))
187 187
188#define luaL_buffsub(B,s) ((B)->n -= (s))
189
188LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); 190LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
189LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); 191LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);
190LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); 192LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
diff --git a/manual/manual.of b/manual/manual.of
index 3d79e7e2..00ab4cd5 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -5005,10 +5005,9 @@ const void luaL_addgsub (luaL_Buffer *B, const char *s,
5005 const char *p, const char *r);| 5005 const char *p, const char *r);|
5006@apii{0,0,m} 5006@apii{0,0,m}
5007 5007
5008Adds a copy of the string @id{s} to the buffer @id{B}, 5008Adds a copy of the string @id{s} to the buffer @id{B} @seeC{luaL_Buffer},
5009replacing any occurrence of the string @id{p} 5009replacing any occurrence of the string @id{p}
5010with the string @id{r}. 5010with the string @id{r}.
5011@seeC{luaL_Buffer}.
5012 5011
5013} 5012}
5014 5013
@@ -5025,7 +5024,7 @@ The string can contain @x{embedded zeros}.
5025@APIEntry{void luaL_addsize (luaL_Buffer *B, size_t n);| 5024@APIEntry{void luaL_addsize (luaL_Buffer *B, size_t n);|
5026@apii{?,?,-} 5025@apii{?,?,-}
5027 5026
5028Adds to the buffer @id{B} @seeC{luaL_Buffer} 5027Adds to the buffer @id{B}
5029a string of length @id{n} previously copied to the 5028a string of length @id{n} previously copied to the
5030buffer area @seeC{luaL_prepbuffer}. 5029buffer area @seeC{luaL_prepbuffer}.
5031 5030
@@ -5157,26 +5156,26 @@ plus the final string on its top.
5157@APIEntry{char *luaL_buffaddr (luaL_Buffer *B);| 5156@APIEntry{char *luaL_buffaddr (luaL_Buffer *B);|
5158@apii{0,0,-} 5157@apii{0,0,-}
5159 5158
5160Returns the address of the current contents of buffer @id{B}. 5159Returns the address of the current contents of buffer @id{B}
5161Note that any addition to the buffer may invalidate this address.
5162@seeC{luaL_Buffer}. 5160@seeC{luaL_Buffer}.
5161Note that any addition to the buffer may invalidate this address.
5163 5162
5164} 5163}
5165 5164
5166@APIEntry{void luaL_buffinit (lua_State *L, luaL_Buffer *B);| 5165@APIEntry{void luaL_buffinit (lua_State *L, luaL_Buffer *B);|
5167@apii{0,0,-} 5166@apii{0,0,-}
5168 5167
5169Initializes a buffer @id{B}. 5168Initializes a buffer @id{B}
5170This function does not allocate any space;
5171the buffer must be declared as a variable
5172@seeC{luaL_Buffer}. 5169@seeC{luaL_Buffer}.
5170This function does not allocate any space;
5171the buffer must be declared as a variable.
5173 5172
5174} 5173}
5175 5174
5176@APIEntry{size_t luaL_bufflen (luaL_Buffer *B);| 5175@APIEntry{size_t luaL_bufflen (luaL_Buffer *B);|
5177@apii{0,0,-} 5176@apii{0,0,-}
5178 5177
5179Returns the length of the current contents of buffer @id{B}. 5178Returns the length of the current contents of buffer @id{B}
5180@seeC{luaL_Buffer}. 5179@seeC{luaL_Buffer}.
5181 5180
5182} 5181}
@@ -5189,6 +5188,15 @@ Equivalent to the sequence
5189 5188
5190} 5189}
5191 5190
5191@APIEntry{void luaL_buffsub (luaL_Buffer *B, int n);|
5192@apii{0,0,-}
5193
5194Removes @id{n} bytes from the the buffer @id{B}
5195@seeC{luaL_Buffer}.
5196The buffer must have at least that many bytes.
5197
5198}
5199
5192@APIEntry{int luaL_callmeta (lua_State *L, int obj, const char *e);| 5200@APIEntry{int luaL_callmeta (lua_State *L, int obj, const char *e);|
5193@apii{0,0|1,e} 5201@apii{0,0|1,e}
5194 5202