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") */
| 533 | * return redis.status_reply("ERR Some Error") |
| 534 | */ |
| 535 | int luaRedisReturnSingleFieldTable(lua_State* lua, const char* field) { |
| 536 | if (lua_gettop(lua) != 1 || lua_type(lua, -1) != LUA_TSTRING) { |
| 537 | luaPushError(lua, "wrong number or type of arguments"); |
| 538 | return 1; |
| 539 | } |
| 540 | |
| 541 | lua_newtable(lua); |
| 542 | lua_pushstring(lua, field); |
| 543 | lua_pushvalue(lua, -3); |
| 544 | lua_settable(lua, -3); |
| 545 | return 1; |
| 546 | } |
| 547 | |
| 548 | /* redis.error_reply() */ |
| 549 | int luaRedisErrorReplyCommand(lua_State* lua) { |
no test coverage detected