aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorforever2k38 <forever2k38@noreply.codeberg.org>2026-08-30 21:04:12 +0200
committerforever2k38 <forever2k38@noreply.codeberg.org>2026-08-30 21:04:12 +0200
commit7c5b012801e45b6537c212f86c502b977651c2d0 (patch)
treeadcfde7acdcc80e786a00208da715019014467d0 /src
parent02fd79105a7fe5ac6a04e76db27b163e4064f759 (diff)
initial lua
Diffstat (limited to 'src')
-rw-r--r--src/args.c4
-rw-r--r--src/config.c5
-rw-r--r--src/config.h2
-rw-r--r--src/main.c5
4 files changed, 12 insertions, 4 deletions
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;
}