diff options
author | 2010-10-22 18:09:16 -0400 | |
---|---|---|
committer | 2010-10-22 18:09:16 -0400 | |
commit | 7c787c527569bcc7db76d64fde678f833a0fb18a (patch) | |
tree | e2ff44eec7a32ea3e4c3672373d19a0ec5b0dd1b /src | |
parent | d36297a9b666e52d5a3fbf9f08b953190ac2c7db (diff) | |
download | textadept-7c787c527569bcc7db76d64fde678f833a0fb18a.tar.gz textadept-7c787c527569bcc7db76d64fde678f833a0fb18a.zip |
Load lpeg and lfs manually instead of modifying Lua itself.
Diffstat (limited to 'src')
-rw-r--r-- | src/lua_interface.c | 7 | ||||
-rw-r--r-- | src/textadept.h | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/lua_interface.c b/src/lua_interface.c index 214f1f1c..0d1dcd8b 100644 --- a/src/lua_interface.c +++ b/src/lua_interface.c @@ -5,6 +5,11 @@ #define streq(s1, s2) strcmp(s1, s2) == 0 #define l_insert(l, i) lua_insert(l, (i < 0) ? lua_gettop(l) + i : i) #define l_append(l, i) lua_rawseti(l, i, lua_objlen(l, i) + 1) +#define l_openlib(l, n, f) { \ + lua_pushcfunction(l, f); \ + lua_pushstring(l, n); \ + lua_call(l, 1, 0); \ +} #define l_cfunc(l, f, k) { \ lua_pushcfunction(l, f); \ lua_setfield(l, -2, k); \ @@ -81,6 +86,8 @@ int l_init(int argc, char **argv, int reinit) { clear_table(lua, LUA_GLOBALSINDEX); } luaL_openlibs(lua); + l_openlib(lua, "lpeg", luaopen_lpeg); + l_openlib(lua, "lfs", luaopen_lfs); lua_newtable(lua); lua_newtable(lua); diff --git a/src/textadept.h b/src/textadept.h index 6d9e2c75..36a848b9 100644 --- a/src/textadept.h +++ b/src/textadept.h @@ -58,4 +58,8 @@ int l_emit_event(const char *, ...); void l_emit_scnnotification(struct SCNotification *); void l_gui_popup_context_menu(GdkEventButton *); +// Extra Lua libraries. +LUALIB_API int (luaopen_lpeg) (lua_State *L); +LUALIB_API int (luaopen_lfs) (lua_State *L); + #endif |