twnlua: prepend /scripts/ in package loader
This commit is contained in:
parent
77ff5c7f25
commit
f365cff590
@ -7,8 +7,6 @@
|
|||||||
#include <lualib.h>
|
#include <lualib.h>
|
||||||
#include <lauxlib.h>
|
#include <lauxlib.h>
|
||||||
|
|
||||||
#include <malloc.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* generated by bindgen.py */
|
/* generated by bindgen.py */
|
||||||
void bindgen_load_twn(lua_State *L);
|
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 */
|
/* 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) {
|
static int physfs_loader(lua_State *L) {
|
||||||
const char *name = luaL_checkstring(L, 1);
|
const char *name = luaL_checkstring(L, 1);
|
||||||
char *final_path = NULL;
|
char *final_path = NULL;
|
||||||
SDL_asprintf(&final_path, "%s.lua", name);
|
SDL_asprintf(&final_path, "/scripts/%s.lua", name);
|
||||||
|
|
||||||
if (!file_exists(final_path)) {
|
if (!file_exists(final_path)) {
|
||||||
char *error_message = NULL;
|
char *error_message = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user