@@ -10,6 +10,8 @@ This [Lua] module provides an array data type and the implementation of the [Car
1010for handling arrays of primitive numeric C data types in Lua script code and also in native
1111C code for enhancing native Lua module interoperability and performance.
1212
13+ * [ Documentation] ( ./doc/README.md#lua-carray-documentation )
14+
1315[ Lua ] : https://www.lua.org
1416[ Carray C API ] : https://github.com/lua-capis/lua-carray-capi
1517
@@ -18,7 +20,7 @@ C code for enhancing native Lua module interoperability and performance.
1820## First Example
1921
2022 ``` lua
21- local carray = require " carray"
23+ local carray = require ( " carray" )
2224
2325local a = carray .new (" int" , 10 )
2426
@@ -52,15 +54,14 @@ assert(x == 202)
5254assert (y == 203 )
5355assert (z == 204 )
5456
55- local c = carray .new (" char" , 10 )
56- c :setstring (1 , " 1234567890" )
57+ local c = carray .new (" char" ):add (" 1234567890" )
5758
5859assert (c :get (1 ) == string.byte (" 1" ))
5960assert (c :tostring () == " 1234567890" )
60- assert (c :tostring (1 ) == " 1" )
61+ assert (c :tostring (1 , 1 ) == " 1" )
6162assert (c :tostring (2 ,4 ) == " 234" )
6263
63- c :setstring (4 , " abc " )
64+ c :set (4 , " ab " , string.byte ( " c " ) )
6465assert (c :tostring () == " 123abc7890" )
6566```
6667
0 commit comments