diff options
author | Yuval Lifshitz <ylifshit@redhat.com> | 2020-11-01 11:49:26 +0100 |
---|---|---|
committer | Yuval Lifshitz <ylifshit@redhat.com> | 2020-12-04 08:55:56 +0100 |
commit | 6ef3e52a3f15465726255ba55f6d5fc89222a92f (patch) | |
tree | 2b6b25168628e3f6e76ad8c3b47c4d044dd8018d /src/rgw/rgw_lua_utils.h | |
parent | Merge pull request #37631 from zjcmszh/aio_setxattr (diff) | |
download | ceph-6ef3e52a3f15465726255ba55f6d5fc89222a92f.tar.xz ceph-6ef3e52a3f15465726255ba55f6d5fc89222a92f.zip |
rgw/lua: support packages via luarocks
Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
Diffstat (limited to 'src/rgw/rgw_lua_utils.h')
-rw-r--r-- | src/rgw/rgw_lua_utils.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/rgw/rgw_lua_utils.h b/src/rgw/rgw_lua_utils.h index e3a7a132cb1..00f3cfdefb5 100644 --- a/src/rgw/rgw_lua_utils.h +++ b/src/rgw/rgw_lua_utils.h @@ -26,6 +26,12 @@ static inline void pushstring(lua_State* L, std::string_view str) lua_pushlstring(L, str.data(), str.size()); } +static inline void unsetglobal(lua_State* L, const char* name) +{ + lua_pushnil(L); + lua_setglobal(L, name); +} + // dump the lua stack to stdout void stack_dump(lua_State* L); @@ -175,5 +181,19 @@ struct EmptyMetaTable { // void create_debug_action(lua_State* L, CephContext* cct); +// set the packages search path according to: +// package.path = "<install_dir>/share/lua/5.3/?.lua" │ LuaRocks. +// package.cpath= "<install_dir>/lib/lua/5.3/?.so" +void set_package_path(lua_State* L, const std::string& install_dir); + +// open standard lua libs and remove the following functions: +// os.exit() +// load() +// loadfile() +// loadstring() +// dofile() +// and the "debug" library +void open_standard_libs(lua_State* L); + } |