aboutsummaryrefslogtreecommitdiff
path: root/src/lua/modules/net/Buffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/modules/net/Buffer.cpp')
-rw-r--r--src/lua/modules/net/Buffer.cpp10
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;
}