aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua_api.c
diff options
context:
space:
mode:
authorGravatar BanceDev 2024-09-12 21:48:50 -0400
committerGravatar BanceDev 2024-09-12 21:48:50 -0400
commitb5857f5aceed86ddb2c538a14a5ec0d41a269bea (patch)
treea711055be35a31cb7a1e44fcf99b159ec84f7df5 /src/lua_api.c
parentUpdate build.yml checkout v4 (diff)
fixed bug in input buffer handling due to misplaced print
Diffstat (limited to 'src/lua_api.c')
-rw-r--r--src/lua_api.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lua_api.c b/src/lua_api.c
index 77417db..99892c7 100644
--- a/src/lua_api.c
+++ b/src/lua_api.c
@@ -87,10 +87,13 @@ void lua_load_script(lua_State *L, const char *script, char **args) {
void lua_run_init(lua_State *L) {
char script_path[64];
- snprintf(script_path, sizeof(script_path), ".lush/%s", "init.lua");
- lua_load_script(L, script_path, NULL);
+ const char *home_dir = getenv("HOME");
+ if (home_dir != NULL) {
+ snprintf(script_path, sizeof(script_path), "%s/.lush/init.lua",
+ home_dir);
+ lua_load_script(L, script_path, NULL);
+ }
}
-
// -- C funtions --
static int execute_command(lua_State *L, const char *line) {
int status = 0;