use string for msgserver request

This commit is contained in:
Cloud Wu
2015-08-12 14:53:36 +08:00
parent 7547126570
commit a4f827a48d
2 changed files with 10 additions and 21 deletions

View File

@@ -506,19 +506,8 @@ ltostring(lua_State *L) {
if (ptr == NULL) {
lua_pushliteral(L, "");
} else {
if (lua_isnumber(L, 3)) {
int offset = lua_tointeger(L, 3);
if (offset < 0) {
return luaL_error(L, "Invalid offset %d", offset);
}
if (offset > size) {
offset = size;
}
lua_pushlstring(L, (const char *)ptr + offset, size-offset);
} else {
lua_pushlstring(L, (const char *)ptr, size);
skynet_free(ptr);
}
lua_pushlstring(L, (const char *)ptr, size);
skynet_free(ptr);
}
return 1;
}