mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-12-04 01:37:27 +00:00
Merge pull request #42 from krmeet/luac
Accept .luac files as valid Lua
This commit is contained in:
commit
978370672d
4 changed files with 9 additions and 7 deletions
4
.gitattributes
vendored
4
.gitattributes
vendored
|
@ -13,6 +13,7 @@
|
||||||
*.ld text
|
*.ld text
|
||||||
*.inc text
|
*.inc text
|
||||||
*.txt text
|
*.txt text
|
||||||
|
*.lua text
|
||||||
*.json text
|
*.json text
|
||||||
*.yaml text
|
*.yaml text
|
||||||
|
|
||||||
|
@ -24,4 +25,5 @@
|
||||||
*.ico binary
|
*.ico binary
|
||||||
*.mp3 binary
|
*.mp3 binary
|
||||||
*.lvl binary
|
*.lvl binary
|
||||||
*.tex binary
|
*.tex binary
|
||||||
|
*.luac binary
|
|
@ -275,7 +275,7 @@ void smlua_init(void) {
|
||||||
gPcDebug.lastModRun = gLuaActiveMod;
|
gPcDebug.lastModRun = gLuaActiveMod;
|
||||||
for (int j = 0; j < mod->fileCount; j++) {
|
for (int j = 0; j < mod->fileCount; j++) {
|
||||||
struct ModFile* file = &mod->files[j];
|
struct ModFile* file = &mod->files[j];
|
||||||
if (!str_ends_with(file->relativePath, ".lua")) {
|
if (!(str_ends_with(file->relativePath, ".lua") || str_ends_with(file->relativePath, ".luac"))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
smlua_load_script(mod, file, i);
|
smlua_load_script(mod, file, i);
|
||||||
|
@ -288,7 +288,7 @@ void smlua_init(void) {
|
||||||
void smlua_update(void) {
|
void smlua_update(void) {
|
||||||
lua_State* L = gLuaState;
|
lua_State* L = gLuaState;
|
||||||
if (L == NULL) { return; }
|
if (L == NULL) { return; }
|
||||||
|
|
||||||
smlua_call_event_hooks(HOOK_UPDATE);
|
smlua_call_event_hooks(HOOK_UPDATE);
|
||||||
// Collect our garbage after calling our hooks.
|
// Collect our garbage after calling our hooks.
|
||||||
// If we don't, Lag can quickly build up from our mods.
|
// If we don't, Lag can quickly build up from our mods.
|
||||||
|
|
|
@ -13,7 +13,7 @@ size_t mod_get_lua_size(struct Mod* mod) {
|
||||||
|
|
||||||
for (int i = 0; i < mod->fileCount; i++) {
|
for (int i = 0; i < mod->fileCount; i++) {
|
||||||
struct ModFile* file = &mod->files[i];
|
struct ModFile* file = &mod->files[i];
|
||||||
if (!str_ends_with(file->relativePath, ".lua")) { continue; }
|
if (!(str_ends_with(file->relativePath, ".lua") || str_ends_with(file->relativePath, ".luac"))) { continue; }
|
||||||
size += file->size;
|
size += file->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,7 +318,7 @@ static bool mod_load_files(struct Mod* mod, char* modName, char* fullPath) {
|
||||||
|
|
||||||
// deal with mod directory
|
// deal with mod directory
|
||||||
{
|
{
|
||||||
const char* fileTypes[] = { ".lua", NULL };
|
const char* fileTypes[] = { ".lua", ".luac", NULL };
|
||||||
if (!mod_load_files_dir(mod, fullPath, "", fileTypes)) { return false; }
|
if (!mod_load_files_dir(mod, fullPath, "", fileTypes)) { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ static bool mod_import_zip(char* path, bool* isLua, bool* isDynos) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_ends_with(file_stat.m_filename, ".lua")) {
|
if (str_ends_with(file_stat.m_filename, ".lua") || str_ends_with(file_stat.m_filename, ".luac")) {
|
||||||
path_get_folder(file_stat.m_filename, luaPath);
|
path_get_folder(file_stat.m_filename, luaPath);
|
||||||
*isLua = true;
|
*isLua = true;
|
||||||
break;
|
break;
|
||||||
|
@ -214,7 +214,7 @@ bool mod_import_file(char* path) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str_ends_with(path, ".lua")) {
|
if (str_ends_with(path, ".lua") || str_ends_with(path, ".luac")) {
|
||||||
isLua = true;
|
isLua = true;
|
||||||
ret = mod_import_lua(path);
|
ret = mod_import_lua(path);
|
||||||
} else if (str_ends_with(path, ".zip")) {
|
} else if (str_ends_with(path, ".zip")) {
|
||||||
|
|
Loading…
Reference in a new issue