Set an array of Redis String Objects as a Lua array (table) stored into a * global variable. */
| 1341 | /* Set an array of Redis String Objects as a Lua array (table) stored into a |
| 1342 | * global variable. */ |
| 1343 | void luaSetGlobalArray(lua_State *lua, const char *var, robj **elev, int elec) { |
| 1344 | int j; |
| 1345 | |
| 1346 | lua_newtable(lua); |
| 1347 | for (j = 0; j < elec; j++) { |
| 1348 | lua_pushlstring(lua,(char*)ptrFromObj(elev[j]),sdslen((sds)ptrFromObj(elev[j]))); |
| 1349 | lua_rawseti(lua,-2,j+1); |
| 1350 | } |
| 1351 | lua_setglobal(lua,var); |
| 1352 | } |
| 1353 | |
| 1354 | /* --------------------------------------------------------------------------- |
| 1355 | * Redis provided math.random |
no test coverage detected