aboutsummaryrefslogtreecommitdiff
path: root/src/lua_build.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua_build.cc')
-rw-r--r--src/lua_build.cc21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/lua_build.cc b/src/lua_build.cc
index bf21f66..75a626a 100644
--- a/src/lua_build.cc
+++ b/src/lua_build.cc
@@ -1,24 +1,15 @@
#include <iostream>
#include <filesystem>
-#include <map>
-extern "C" {
-#include <luajit-2.1/lua.h>
-#include <luajit-2.1/lauxlib.h>
-#include <luajit-2.1/lualib.h>
-}
-
+#include <unordered_map>
+#include "lua_state.hh"
#include "lua_build.hh"
#include "vars.hh"
-std::map<std::string, int> build_files;
+std::unordered_map<std::string, int> build_files;
bool lua_build(const char *path) {
- lua_State *L = lua_open();
- luaL_openlibs(L);
-
- if (luaL_loadfile(L, config_file.c_str()) || lua_pcall(L, 0, 0, 0)){
- std::cout << print_error << "cannot run configuration script: " << lua_tostring(L, -1) << "\n";
- }
+ init_lua_state();
+ lua_State *L = get_lua_state();
lua_getglobal(L, "build_systems");
@@ -57,4 +48,4 @@ bool lua_build(const char *path) {
lua_pop(L, 1);
}
return build_found;
-}
+} \ No newline at end of file