Make compiled lua load again (#80)

This commit is contained in:
PeachyPeach 2024-06-27 02:19:29 +02:00 committed by GitHub
parent 0b8370eacb
commit dc02aa9881
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -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;