Update README.md
This commit is contained in:
parent
8a9a3c79b4
commit
d090b325ab
20
README.md
20
README.md
@ -27,6 +27,16 @@ local y = ByteArray.init( 0, 1, 2, 3 ) -- create a byte array with initial bytes
|
||||
local z = ByteArray.load( "hello" ) -- create a byte array with a lua string object
|
||||
```
|
||||
|
||||
# indexing
|
||||
Index start from 1 to length. If out of range, return -1.
|
||||
|
||||
```lua
|
||||
local buf = ByteArray.init(2,3)
|
||||
print(buf[1]) -- 2
|
||||
print(buf[2]) -- 3
|
||||
print(buf[3]) -- -1
|
||||
```
|
||||
|
||||
# reading data
|
||||
`readByte()` Read a 8-bit signed integer from byte array.
|
||||
`readUnsignedByte()` Read a 8-bit unsigned integer from byte array.
|
||||
@ -138,13 +148,3 @@ Set / get endian.
|
||||
local buf = ByteArray.init(2,3)
|
||||
buf.endian = ByteArray.LITTLE_ENDIAN
|
||||
```
|
||||
|
||||
# indexing
|
||||
Index start from 1 to length. If out of range, return -1.
|
||||
|
||||
```lua
|
||||
local buf = ByteArray.init(2,3)
|
||||
print(buf[1]) -- 2
|
||||
print(buf[2]) -- 3
|
||||
print(buf[3]) -- -1
|
||||
```
|
||||
|
Loading…
x
Reference in New Issue
Block a user