| 1239 | } |
| 1240 | |
| 1241 | const char *RedisProtocolToLuaTypeVerbatimString(lua_State *lua, const char *reply) { |
| 1242 | const char *p = strchr(reply + 1, '\r'); |
| 1243 | int64_t bulklen = ParseInt<int64_t>(std::string(reply + 1, p - reply - 1), 10).ValueOr(0); |
| 1244 | p += 2; // skip \r\n |
| 1245 | |
| 1246 | lua_newtable(lua); |
| 1247 | lua_pushstring(lua, "verbatim_string"); |
| 1248 | |
| 1249 | lua_newtable(lua); |
| 1250 | lua_pushstring(lua, "string"); |
| 1251 | lua_pushlstring(lua, p + 4, bulklen - 4); |
| 1252 | lua_settable(lua, -3); |
| 1253 | |
| 1254 | lua_pushstring(lua, "format"); |
| 1255 | lua_pushlstring(lua, p, 3); |
| 1256 | lua_settable(lua, -3); |
| 1257 | |
| 1258 | lua_settable(lua, -3); |
| 1259 | return p + bulklen + 2; |
| 1260 | } |
| 1261 | |
| 1262 | /* This function is used in order to push an error on the Lua stack in the |
| 1263 | * format used by redis.pcall to return errors, which is a lua table |
no test coverage detected