aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meson.build2
-rw-r--r--src/args.c4
-rw-r--r--src/config.c5
-rw-r--r--src/config.h2
-rw-r--r--src/main.c5
5 files changed, 13 insertions, 5 deletions
diff --git a/meson.build b/meson.build
index 92c300a..d80b3ce 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
project('pow', 'c', default_options: ['c_std=c99'])
deps = [
- dependency('luajit')
+ dependency('lua54')
]
sources = [
diff --git a/src/args.c b/src/args.c
index 424492c..445d276 100644
--- a/src/args.c
+++ b/src/args.c
@@ -11,8 +11,8 @@ char *help = "pow! - the pow!erful package manager\n"
"This software comes with no warranty.\n"
"\n"
"Usage: pow\n"
- " --help Prints this help message\n"
- " -c Specify config file path.\n";
+ " --help Prints this help message.\n"
+ " -c Specify config file path.\n";
int pow_args_parse(int argc, char **argv, pow_args *args) {
int flags = 0;
diff --git a/src/config.c b/src/config.c
index 33d59b8..4019e7b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1,8 +1,9 @@
#include "config.h"
#include "lauxlib.h"
+#include "lualib.h"
-int open_config(pow_config *cfg, char *path) {
+int pow_open_config(pow_config *cfg, char *path) {
int err;
cfg->L = luaL_newstate();
@@ -13,6 +14,8 @@ int open_config(pow_config *cfg, char *path) {
lua_State *L = cfg->L; // just easier to access
+ luaL_openlibs(L);
+
err = luaL_loadfile(L, path);
if (err) {
diff --git a/src/config.h b/src/config.h
index 9150a82..ba2d319 100644
--- a/src/config.h
+++ b/src/config.h
@@ -8,4 +8,4 @@ typedef struct {
lua_State *L;
} pow_config;
-int open_config(pow_config *cfg, char *path);
+int pow_open_config(pow_config *cfg, char *path);
diff --git a/src/main.c b/src/main.c
index 4de964d..1eff24e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,4 +1,5 @@
#include "args.h"
+#include "config.h"
int main(int argc, char *argv[]) {
pow_args args = {0};
@@ -11,5 +12,9 @@ int main(int argc, char *argv[]) {
return 0;
}
+ pow_config config = {0};
+
+ pow_open_config(&config, "config.lua");
+
return 0;
}