aboutsummaryrefslogtreecommitdiff
path: root/vis-lua.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-11-18 21:35:52 -0800
committerMichael Forney <mforney@mforney.org>2016-12-12 17:41:16 -0800
commitfceff74eae7daf2026a515448f62eb99ba1b83d6 (patch)
treeffac00002a1f8915cee9f7836e72ae6bccc02ae1 /vis-lua.c
parent37d98f3119d5d3a63492bf9683ec6a4d68cc1e28 (diff)
downloadvis-fceff74eae7daf2026a515448f62eb99ba1b83d6.tar.gz
vis-fceff74eae7daf2026a515448f62eb99ba1b83d6.tar.xz
Allow building lpeg into vis
If lpeg is built statically, this allows for a completely static vis binary that still supports syntax highlighting.
Diffstat (limited to 'vis-lua.c')
-rw-r--r--vis-lua.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/vis-lua.c b/vis-lua.c
index 29e94ef..95cfe6e 100644
--- a/vis-lua.c
+++ b/vis-lua.c
@@ -1889,6 +1889,15 @@ void vis_lua_init(Vis *vis) {
vis->lua = L;
luaL_openlibs(L);
+#if CONFIG_BUILTIN_LPEG
+ extern int luaopen_lpeg(lua_State *L);
+ lua_getglobal(L, "package");
+ lua_getfield(L, -1, "preload");
+ lua_pushcfunction(L, luaopen_lpeg);
+ lua_setfield(L, -2, "lpeg");
+ lua_pop(L, 2);
+#endif
+
/* remove any relative paths from lua's default package.path */
vis_lua_path_strip(vis);