twnlua: prepend /scripts/ in package loader

This commit is contained in:
veclavtalica 2025-01-26 11:35:34 +03:00
parent 77ff5c7f25
commit f365cff590

View File

@ -7,8 +7,6 @@
#include <lualib.h>
#include <lauxlib.h>
#include <malloc.h>
/* generated by bindgen.py */
void bindgen_load_twn(lua_State *L);
@ -18,10 +16,11 @@ void bindgen_upload_context(lua_State *L);
/* require will go through physicsfs exclusively so that scripts can be in the data dir */
/* TODO: allow for bytecode files */
static int physfs_loader(lua_State *L) {
const char *name = luaL_checkstring(L, 1);
char *final_path = NULL;
SDL_asprintf(&final_path, "%s.lua", name);
SDL_asprintf(&final_path, "/scripts/%s.lua", name);
if (!file_exists(final_path)) {
char *error_message = NULL;