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") */
| 897 | * return redis.status_reply("ERR Some Error") |
| 898 | */ |
| 899 | int luaRedisReturnSingleFieldTable(lua_State *lua, const char *field) { |
| 900 | if (lua_gettop(lua) != 1 || lua_type(lua,-1) != LUA_TSTRING) { |
| 901 | luaPushError(lua, "wrong number or type of arguments"); |
| 902 | return 1; |
| 903 | } |
| 904 | |
| 905 | lua_newtable(lua); |
| 906 | lua_pushstring(lua, field); |
| 907 | lua_pushvalue(lua, -3); |
| 908 | lua_settable(lua, -3); |
| 909 | return 1; |
| 910 | } |
| 911 | |
| 912 | /* redis.error_reply() */ |
| 913 | int luaRedisErrorReplyCommand(lua_State *lua) { |
no test coverage detected