这里有个例子: ~~~lua local old_buffer = woo.buffer:new("123456") local bts = woo.buffer:new("0") bts:w(old_buffer) bts:w('78') _out(bts:bytes(), '\n') _out(bts:str(), '\n') print('one bytes:', bts:at(0)) bts:go(2) _out(bts:r(1), '\n') _out(bts:rbDelim(53), '\n') _out(bts:rb(), '\n') _out(bts:r(), '\n') print(bts:len()) bts:rm(1, 2) _out('rm left:', bts:bytes(), '\n') _out(bts:str(), '\n') bts:trimInd(-1) _out('trimInd left:', bts:bytes(), '\n') _out(bts:str(), '\n') _out(bts:r(), '\n') bts:w(12458) _out('read number:', bts:rNum(), '\n') _out(bts:str(), '\n') print('=================') bts:w('zz') --bts:rb() print(bts:offset()) bts:set(1, 80) bts:inr(1, '\n\n\n') _out(bts:r(), '\n') _out(bts:str(), '\n') _out(bts:bytes(), '\n') ~~~