MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / luaSetResp

Function luaSetResp

src/scripting.cpp:1037–1053  ·  view source on GitHub ↗

redis.setresp() */

Source from the content-addressed store, hash-verified

1035
1036/* redis.setresp() */
1037int luaSetResp(lua_State *lua) {
1038 int argc = lua_gettop(lua);
1039
1040 if (argc != 1) {
1041 lua_pushstring(lua, "redis.setresp() requires one argument.");
1042 return lua_error(lua);
1043 }
1044
1045 int resp = lua_tonumber(lua,-argc);
1046 if (resp != 2 && resp != 3) {
1047 lua_pushstring(lua, "RESP version must be 2 or 3.");
1048 return lua_error(lua);
1049 }
1050
1051 serverTL->lua_client->resp = resp;
1052 return 0;
1053}
1054
1055/* ---------------------------------------------------------------------------
1056 * Lua engine initialization and reset.

Callers

nothing calls this directly

Calls 4

lua_gettopFunction · 0.85
lua_pushstringFunction · 0.85
lua_errorFunction · 0.85
lua_tonumberFunction · 0.85

Tested by

no test coverage detected