Skip to content

Commit e65141b

Browse files
committed
Improve 'Preparing buffers' section
1 parent 0489a09 commit e65141b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,28 @@ conn.space.s:select(nil, {buffer = buf})
146146
local buf_str = ffi.string(buf.rpos, buf.wpos - buf.rpos)
147147
local buf_lua = msgpack.decode(buf_str)
148148
print('select:\n' .. yaml.encode(buf_lua))
149+
-- {48: [[1], [2], [3], [4]]}
150+
151+
local buf = buffer.ibuf()
152+
conn.space.s:select(nil, {buffer = buf, skip_header = true})
153+
local buf_str = ffi.string(buf.rpos, buf.wpos - buf.rpos)
154+
local buf_lua = msgpack.decode(buf_str)
155+
print('select:\n' .. yaml.encode(buf_lua))
156+
-- [[1], [2], [3], [4]]
149157

150158
local buf = buffer.ibuf()
151159
conn:call('foo', nil, {buffer = buf})
152160
local buf_str = ffi.string(buf.rpos, buf.wpos - buf.rpos)
153161
local buf_lua = msgpack.decode(buf_str)
154162
print('call:\n' .. yaml.encode(buf_lua))
163+
-- {48: [[[1], [2], [3], [4]]]}
164+
165+
local buf = buffer.ibuf()
166+
conn:call('foo', nil, {buffer = buf, skip_header = true})
167+
local buf_str = ffi.string(buf.rpos, buf.wpos - buf.rpos)
168+
local buf_lua = msgpack.decode(buf_str)
169+
print('call:\n' .. yaml.encode(buf_lua))
170+
-- [[[1], [2], [3], [4]]]
155171

156172
os.exit()
157173
```

0 commit comments

Comments
 (0)