MCPcopy Create free account
hub / github.com/F-Stack/f-stack / luaSetGlobalArray

Function luaSetGlobalArray

app/redis-6.2.6/src/scripting.c:1330–1339  ·  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

1328/* Set an array of Redis String Objects as a Lua array (table) stored into a
1329 * global variable. */
1330void luaSetGlobalArray(lua_State *lua, char *var, robj **elev, int elec) {
1331 int j;
1332
1333 lua_newtable(lua);
1334 for (j = 0; j < elec; j++) {
1335 lua_pushlstring(lua,(char*)elev[j]->ptr,sdslen(elev[j]->ptr));
1336 lua_rawseti(lua,-2,j+1);
1337 }
1338 lua_setglobal(lua,var);
1339}
1340
1341/* ---------------------------------------------------------------------------
1342 * Redis provided math.random

Callers 1

evalGenericCommandFunction · 0.85

Calls 4

sdslenFunction · 0.85
lua_setglobalFunction · 0.85
lua_pushlstringFunction · 0.50
lua_rawsetiFunction · 0.50

Tested by

no test coverage detected