MCPcopy Create free account
hub / github.com/Tencent/Tendis / luaSetGlobalArray

Function luaSetGlobalArray

src/tendisplus/script/lua_state.cpp:252–265  ·  view source on GitHub ↗

Set an array of Redis String Objects as a Lua array (table) stored into a * global variable. */

Source from the content-addressed store, hash-verified

250/* Set an array of Redis String Objects as a Lua array (table) stored into a
251 * global variable. */
252void luaSetGlobalArray(lua_State* lua,
253 const std::string& var,
254 const std::vector<std::string>& args,
255 int start,
256 int num) {
257 int j;
258
259 lua_newtable(lua);
260 for (j = 0; j < num; j++) {
261 lua_pushlstring(lua, args[start + j].c_str(), args[start + j].length());
262 lua_rawseti(lua, -2, j + 1);
263 }
264 lua_setglobal(lua, var.c_str());
265}
266
267/* ---------------------------------------------------------------------------
268 * Redis provided math.random

Callers 1

evalGenericCommandMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected