Skip to content

Commit 1589a08

Browse files
committed
methods renamedd: add -> append
1 parent 509e4a5 commit 1589a08

File tree

5 files changed

+153
-153
lines changed

5 files changed

+153
-153
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ assert(x == 202)
5454
assert(y == 203)
5555
assert(z == 204)
5656

57-
local c = carray.new("char"):add("1234567890")
57+
local c = carray.new("char"):append("1234567890")
5858

5959
assert(c:get(1) == string.byte("1"))
6060
assert(c:tostring() == "1234567890")

doc/README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
* [Array Methods](#array-methods)
1111
* [array:get()](#array_get)
1212
* [array:set()](#array_set)
13-
* [array:add()](#array_add)
13+
* [array:append()](#array_append)
1414
* [array:insert()](#array_insert)
1515
* [array:setsub()](#array_setsub)
16-
* [array:addsub()](#array_addsub)
16+
* [array:appendsub()](#array_appendsub)
1717
* [array:insertsub()](#array_insertsub)
1818
* [array:remove()](#array_remove)
1919
* [array:len()](#array_len)
@@ -147,14 +147,14 @@ Array objects can be created by calling the module function [carray.new()](#carr
147147

148148
<!-- ---------------------------------------------------------------------------------------- -->
149149

150-
* <a id="array_add">**` array:add(...)
150+
* <a id="array_append">**` array:append(...)
151151
`** </a>
152152

153-
Adds the given elements to the end of the array object.
153+
Appends the given elements to the end of the array object.
154154

155-
* *...* - list of elements or array objects that are added to the end of the array object.
155+
* *...* - list of elements or array objects that are appended to the end of the array object.
156156
If the array element type is *signed char* or *unsigned char*
157-
(see [Element Type Names](#element-type-names)), it is also possible to add
157+
(see [Element Type Names](#element-type-names)), it is also possible to append
158158
string values.
159159

160160

@@ -201,23 +201,23 @@ Array objects can be created by calling the module function [carray.new()](#carr
201201

202202
<!-- ---------------------------------------------------------------------------------------- -->
203203

204-
* <a id="array_addsub">**` array:addsub(array2, pos1, pos2)
204+
* <a id="array_appendsub">**` array:appendsub(array2, pos1, pos2)
205205
`** </a>
206206

207-
Adds elements of another array *array2* to the end of the array object.
207+
Appends elements of another array *array2* to the end of the array object.
208208

209209
* *array2* - source array.
210210
If the destination array element type is *signed char* or *unsigned char*
211211
(see [Element Type Names](#element-type-names)), it is also possible to give
212212
a string value here.
213-
* *pos1* - integer position of the first element to add from *array2*.
214-
* *pos2* - integer position of the last element of *array2* to add.
213+
* *pos1* - integer position of the first element to append from *array2*.
214+
* *pos2* - integer position of the last element of *array2* to append.
215215

216-
The first element in the array has position 1, i.e. *array:addsub(array2, 1, 3)* adds the
216+
The first element in the array has position 1, i.e. *array:appendsub(array2, 1, 3)* appends the
217217
first three elements of *array2* to the array.
218218

219219
*pos1* or *pos2* may be negative to denote positions from behind, e.g.
220-
*array:addsub(array2,-3,-1)* adds the last three elements of *array2* to the array object.
220+
*array:appendsub(array2,-3,-1)* appends the last three elements of *array2* to the array object.
221221

222222

223223
<!-- ---------------------------------------------------------------------------------------- -->
@@ -341,7 +341,7 @@ Array objects can be created by calling the module function [carray.new()](#carr
341341
`** </a>
342342

343343
Sets or get the reserve count. The reserve count denotes the number of new elements that
344-
can be added to the array without the need to re-allocate the array's memory.
344+
can be appended to the array without the need to re-allocate the array's memory.
345345

346346
* *count* - optional integer, if greater zero this methods assures that the reserve is at
347347
least *count* number of elements. If zero or less the reserve is

examples/example01.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ assert(x == 202)
3232
assert(y == 203)
3333
assert(z == 204)
3434

35-
local c = carray.new("char"):add("1234567890")
35+
local c = carray.new("char"):append("1234567890")
3636

3737
assert(c:get(1) == string.byte("1"))
3838
assert(c:tostring() == "1234567890")

src/carray.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ static int internalInsert(lua_State* L, carray* impl, int insertPos, int firstAr
867867

868868
/* ============================================================================================ */
869869

870-
static int Carray_add(lua_State* L)
870+
static int Carray_append(lua_State* L)
871871
{
872872
int arg = 1;
873873
CarrayUserData* udata = checkWritableUdata(L, arg++);
@@ -895,7 +895,7 @@ static int Carray_insert(lua_State* L)
895895

896896
/* ============================================================================================ */
897897

898-
static int Carray_addsub(lua_State* L)
898+
static int Carray_appendsub(lua_State* L)
899899
{
900900
int arg = 1;
901901
carray* impl1 = checkWritableUdata(L, arg++)->impl;
@@ -1311,9 +1311,9 @@ static const luaL_Reg CarrayMethods[] =
13111311
{ "len", Carray_len },
13121312
{ "get", Carray_get },
13131313
{ "set", Carray_set },
1314-
{ "add", Carray_add },
1314+
{ "append", Carray_append },
13151315
{ "insert", Carray_insert },
1316-
{ "addsub", Carray_addsub },
1316+
{ "appendsub", Carray_appendsub },
13171317
{ "insertsub", Carray_insertsub },
13181318
{ "setsub", Carray_setsub },
13191319
{ "remove", Carray_remove },

0 commit comments

Comments
 (0)