diff options
author | chai <chaifix@163.com> | 2018-09-08 14:52:17 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2018-09-08 14:52:17 +0800 |
commit | 7c3609b04eabc79db0c0b245a155fc3c5e875053 (patch) | |
tree | 9333f727863c8fed738bd16eaf6d9e2f0d4f53b5 /src/lua/modules/net/Buffer.cpp | |
parent | 1ccc798ca383fc941d624751293ed88e012900d1 (diff) |
*update
Diffstat (limited to 'src/lua/modules/net/Buffer.cpp')
-rw-r--r-- | src/lua/modules/net/Buffer.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lua/modules/net/Buffer.cpp b/src/lua/modules/net/Buffer.cpp index cc9f2b4..1a62c9a 100644 --- a/src/lua/modules/net/Buffer.cpp +++ b/src/lua/modules/net/Buffer.cpp @@ -68,10 +68,12 @@ namespace net { BufferRef ref = checkNetBuffer(L); int offset = luax_checkinteger(L, 2); - int len; - const char* str = ref->grabString(&len, offset); - luax_pushstring(L, str); - luax_pushinteger(L, len); + unsigned int len; + char* data = ref->grabString(&len, offset); + Array<char> str; + str.bind(data, len); + luax_pushstring(L, &str); + luax_pushinteger(L, str.count()); return 2; } |