| 86 | } |
| 87 | |
| 88 | void LoadFuncs(lua_State *lua) { |
| 89 | lua_newtable(lua); |
| 90 | |
| 91 | /* redis.call */ |
| 92 | lua_pushstring(lua, "call"); |
| 93 | lua_pushcfunction(lua, RedisCallCommand); |
| 94 | lua_settable(lua, -3); |
| 95 | |
| 96 | /* redis.pcall */ |
| 97 | lua_pushstring(lua, "pcall"); |
| 98 | lua_pushcfunction(lua, RedisPCallCommand); |
| 99 | lua_settable(lua, -3); |
| 100 | |
| 101 | /* redis.setresp */ |
| 102 | lua_pushstring(lua, "setresp"); |
| 103 | lua_pushcfunction(lua, RedisSetResp); |
| 104 | lua_settable(lua, -3); |
| 105 | |
| 106 | /* redis.log and log levels. */ |
| 107 | lua_pushstring(lua, "log"); |
| 108 | lua_pushcfunction(lua, RedisLogCommand); |
| 109 | lua_settable(lua, -3); |
| 110 | |
| 111 | lua_pushstring(lua, "LOG_DEBUG"); |
| 112 | lua_pushnumber(lua, LL_DEBUG); |
| 113 | lua_settable(lua, -3); |
| 114 | |
| 115 | lua_pushstring(lua, "LOG_VERBOSE"); |
| 116 | lua_pushnumber(lua, LL_VERBOSE); |
| 117 | lua_settable(lua, -3); |
| 118 | |
| 119 | lua_pushstring(lua, "LOG_NOTICE"); |
| 120 | lua_pushnumber(lua, LL_NOTICE); |
| 121 | lua_settable(lua, -3); |
| 122 | |
| 123 | lua_pushstring(lua, "LOG_WARNING"); |
| 124 | lua_pushnumber(lua, LL_WARNING); |
| 125 | lua_settable(lua, -3); |
| 126 | |
| 127 | /* redis.sha1hex */ |
| 128 | lua_pushstring(lua, "sha1hex"); |
| 129 | lua_pushcfunction(lua, RedisSha1hexCommand); |
| 130 | lua_settable(lua, -3); |
| 131 | |
| 132 | /* redis.error_reply and redis.status_reply */ |
| 133 | lua_pushstring(lua, "error_reply"); |
| 134 | lua_pushcfunction(lua, RedisErrorReplyCommand); |
| 135 | lua_settable(lua, -3); |
| 136 | lua_pushstring(lua, "status_reply"); |
| 137 | lua_pushcfunction(lua, RedisStatusReplyCommand); |
| 138 | lua_settable(lua, -3); |
| 139 | |
| 140 | /* redis.register_function */ |
| 141 | lua_pushstring(lua, "register_function"); |
| 142 | lua_pushcfunction(lua, RedisRegisterFunction); |
| 143 | lua_settable(lua, -3); |
| 144 | |
| 145 | lua_setglobal(lua, "redis"); |