[MOON/MoonLoader] ___SearchModLoaderLog: Mod Loader support for MoonLoader
Enviado: 08 Ago 2020, 18:46
Note: If not working with AutoID3000 3002 or later, refer to here.
Hey guys.
Since the blokes at GTAForums have trouble figuring out whether to approve my topic or not (not their fault, the topic I wrote was a mess), I suppose I should also post here. Besides, there are more known lua coders here than there, and their feedback will be invaluable. Anyways, presenting:
___SearchModLoaderLog
Description:
This is a lua script that is mainly for lua coders, like a plugin.
It creates and stores a table of all the files that were found by Mod Loader but not loaded. It does so by reading the modloader.log file and matching the text strings. Then, the list, along with a couple functions, is exported for use by other lua scripts. The best thing is that it supports profiles, ignored mods, exclusive mods, and most features of Mod Loader, excluding priority.
Requirements:
MoonLoader
Mod Loader
Download:
1.0
1.1
1.2
1.3
Note: The script file is intentionally named with three underscores so that it is loaded before other scripts. Changing the file name may result in errors.
Installation Instructions
Mods Using this Script:
[MOON/MoonLoader] Load Scripts from Mod Loader
Usage:
Here is an example how lua coders can use this in their scripts:
___SearchModLoaderLog - Test.lua:
P.S.:
I am really proud of this, and I hope you guys can find some use out of this. In my opinion, modding capabilities for lua have just multiplied. I will post some scripts that make use of this to show you guys more of its potential.
Credits:
HzanRsxa2959,
with help from StackOverflow
Hey guys.
Since the blokes at GTAForums have trouble figuring out whether to approve my topic or not (not their fault, the topic I wrote was a mess), I suppose I should also post here. Besides, there are more known lua coders here than there, and their feedback will be invaluable. Anyways, presenting:
___SearchModLoaderLog
Description:
This is a lua script that is mainly for lua coders, like a plugin.
It creates and stores a table of all the files that were found by Mod Loader but not loaded. It does so by reading the modloader.log file and matching the text strings. Then, the list, along with a couple functions, is exported for use by other lua scripts. The best thing is that it supports profiles, ignored mods, exclusive mods, and most features of Mod Loader, excluding priority.
Requirements:
MoonLoader
Mod Loader
Download:
1.0
1.1
1.2
1.3
Note: The script file is intentionally named with three underscores so that it is loaded before other scripts. Changing the file name may result in errors.
Installation Instructions
Mods Using this Script:
[MOON/MoonLoader] Load Scripts from Mod Loader
Usage:
Here is an example how lua coders can use this in their scripts:
___SearchModLoaderLog - Test.lua:
Código: Selecionar tudo
script_author("HzanRsxa2959")
script_version("1.0")
script_description("Test script for ___SearchModLoaderLog.")
script_properties("work-in-pause")
script_dependencies("___SearchModLoaderLog")
--imported data:
--table files
--function filterFiles
--filters table of files based on extension(s) and subfolders(s)
--syntax: table filtered = filterFiles(string extension / table extensions [, string subfolder / table subfolders, table list])
--if table is not given, then it will filter the default table
--function getParentPath
--gets the parent path of a directory, seems like a handy function so I included it
--syntax: string parentpath = getParentPath(string path)
local smdl = import("___SearchModLoaderLog.lua") --import data
print("Starting.")
local extensions = {"hzn", "hzan"}
local subfolders = {"hzn", "hzan"}
local files = smdl.filterFiles(extensions, subfolder) --filter out files from default table with extension 'hzn' or 'hzan' inside subfolders named 'hzn' or 'hzan'
for i, file in ipairs(files)do --loop through table
print("found file", file) --print found files
end
print("total files:", #files) --print total files
print("Done.")
--exitP.S.:
I am really proud of this, and I hope you guys can find some use out of this. In my opinion, modding capabilities for lua have just multiplied. I will post some scripts that make use of this to show you guys more of its potential.
Credits:
HzanRsxa2959,
with help from StackOverflow