mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-25 19:42:20 +00:00
Implement peachy's suggestion
This commit is contained in:
parent
e7141e833e
commit
1d35dda286
5 changed files with 11 additions and 8 deletions
|
|
@ -11605,7 +11605,7 @@ function get_active_mod()
|
|||
end
|
||||
|
||||
--- @param mod Mod
|
||||
--- @param subDirectory string
|
||||
--- @param subDirectory? string
|
||||
--- @return table
|
||||
--- Gets all files a mod contains
|
||||
function get_mod_files(mod, subDirectory)
|
||||
|
|
|
|||
|
|
@ -2104,7 +2104,7 @@ Gets all files a mod contains
|
|||
- `table`
|
||||
|
||||
### C Prototype
|
||||
`LuaTable get_mod_files(struct Mod* mod, const char* subDirectory);`
|
||||
`LuaTable get_mod_files(struct Mod* mod, OPTIONAL const char* subDirectory);`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
|
|
|
|||
|
|
@ -34633,15 +34633,18 @@ int smlua_func_get_mod_files(lua_State* L) {
|
|||
if (L == NULL) { return 0; }
|
||||
|
||||
int top = lua_gettop(L);
|
||||
if (top != 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_mod_files", 2, top);
|
||||
if (top < 1 || top > 2) {
|
||||
LOG_LUA_LINE("Improper param count for '%s': Expected between %u and %u, Received %u", "get_mod_files", 1, 2, top);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct Mod* mod = (struct Mod*)smlua_to_cobject(L, 1, LOT_MOD);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 1, "get_mod_files"); return 0; }
|
||||
const char* subDirectory = smlua_to_string(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_mod_files"); return 0; }
|
||||
const char* subDirectory = (const char*) NULL;
|
||||
if (top >= 2) {
|
||||
subDirectory = smlua_to_string(L, 2);
|
||||
if (!gSmLuaConvertSuccess) { LOG_LUA("Failed to convert parameter %u for function '%s'", 2, "get_mod_files"); return 0; }
|
||||
}
|
||||
|
||||
smlua_push_lua_table(L, get_mod_files(mod, subDirectory));
|
||||
|
||||
|
|
|
|||
|
|
@ -601,7 +601,7 @@ struct Mod* get_active_mod(void) {
|
|||
return gLuaActiveMod;
|
||||
}
|
||||
|
||||
LuaTable get_mod_files(struct Mod* mod, const char* subDirectory) {
|
||||
LuaTable get_mod_files(struct Mod* mod, OPTIONAL const char* subDirectory) {
|
||||
if (!mod || !subDirectory) {
|
||||
struct lua_State *L = gLuaState;
|
||||
if (L) {
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ bool mod_file_exists(const char* filename);
|
|||
/* |description|Gets the mod currently being processed|descriptionEnd| */
|
||||
struct Mod* get_active_mod(void);
|
||||
/* |description|Gets all files a mod contains|descriptionEnd| */
|
||||
LuaTable get_mod_files(struct Mod* mod, const char* subDirectory);
|
||||
LuaTable get_mod_files(struct Mod* mod, OPTIONAL const char* subDirectory);
|
||||
|
||||
/* |description|Sets the window title to a custom title|descriptionEnd| */
|
||||
void set_window_title(const char* title);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue