From dc02aa9881d428d86805fa9b14a019bf167ca725 Mon Sep 17 00:00:00 2001 From: PeachyPeach <72323920+PeachyPeachSM64@users.noreply.github.com> Date: Thu, 27 Jun 2024 02:19:29 +0200 Subject: [PATCH] Make compiled lua load again (#80) --- src/pc/lua/smlua.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pc/lua/smlua.c b/src/pc/lua/smlua.c index 9c7bf39e..bbf55e30 100644 --- a/src/pc/lua/smlua.c +++ b/src/pc/lua/smlua.c @@ -210,7 +210,7 @@ static void smlua_load_script(struct Mod* mod, struct ModFile* file, u16 remoteI f_seek(f, 0, SEEK_END); size_t length = f_tell(f); - char *buffer = calloc(length + 1, 1); + void *buffer = calloc(length + 1, 1); if (!buffer) { LOG_LUA("Failed to load lua script '%s': Cannot allocate buffer.", file->cachedPath); gLuaInitializingScript = 0; @@ -226,7 +226,7 @@ static void smlua_load_script(struct Mod* mod, struct ModFile* file, u16 remoteI f_close(f); f_delete(f); - if (luaL_loadstring(L, buffer) != LUA_OK) { // only run on success + if (luaL_loadbuffer(L, buffer, length, file->cachedPath) != LUA_OK) { // only run on success LOG_LUA("Failed to load lua script '%s'.", file->cachedPath); LOG_LUA("%s", smlua_to_string(L, lua_gettop(L))); gLuaInitializingScript = 0;