Created
October 17, 2023 14:46
-
-
Save outsinre/d9f04f9a92e2f0f013ccdc5cf4d44c64 to your computer and use it in GitHub Desktop.
string buffer consumption
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local sb = require "string.buffer" | |
| local buff = sb.new() | |
| buff:put("a", "", "c") | |
| print("buff len after put: ", #buff) | |
| local str = buff:get() | |
| print("1st get: ", str) | |
| print("buff len after 1st get: ", #buff) | |
| str = buff:get() | |
| print("2nd get: ", str) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
~ $ luajit test.luaThe 1st
buffer:get()will consume and empty the buffer.