Returns a table with a single field 'field' set to the string value * passed as argument. This helper function is handy when returning * a Redis Protocol error or status reply from Lua: * * return redis.error_reply("ERR Some Error") * return redis.status_reply("ERR Some Error") */
| 961 | * return redis.status_reply("ERR Some Error") |
| 962 | */ |
| 963 | int RedisReturnSingleFieldTable(lua_State *lua, const char *field) { |
| 964 | if (lua_gettop(lua) != 1 || lua_type(lua, -1) != LUA_TSTRING) { |
| 965 | PushError(lua, "wrong number or type of arguments"); |
| 966 | return 1; |
| 967 | } |
| 968 | |
| 969 | lua_newtable(lua); |
| 970 | lua_pushstring(lua, field); |
| 971 | lua_pushvalue(lua, -3); |
| 972 | lua_settable(lua, -3); |
| 973 | return 1; |
| 974 | } |
| 975 | |
| 976 | int RedisSetResp(lua_State *lua) { |
| 977 | auto *script_run_ctx = GetFromRegistry<ScriptRunCtx>(lua, REGISTRY_SCRIPT_RUN_CTX_NAME); |
no test coverage detected