Add's a new method, SMODS.load_file(path, id). This method take's in a path, relative to the mod's main directory, and optinally the mod id (will use SMODS.current_mod if not. Just got thinking should I require the mod object instead of the id?). It then reads the file and loads it. Return type is the same as love.filesystem.load and loadfile.
Example:
Main.lua
--- STEAMODDED HEADER
--- MOD_NAME: Load Test
--- MOD_ID: LoadTest
--- MOD_AUTHOR: [WilsontheWolf]
--- MOD_DESCRIPTION: Testing for new api
----------------------------------------------
------------MOD CODE -------------------------
local mod = SMODS.current_mod;
assert(SMODS.load_file("Loaded.lua"))()
----------------------------------------------
------------MOD CODE END----------------------
Loaded.lua
print("Hi mom")
-- error("Test") -- Uncomment me to see that my filename is properly shown in the crash log
Also fixes a parsing issue in StackTracePlus, which I encountered testing if this worked.
Also nil's current_mod after loading mods, which prevents mods from accidentally loading files from another mod's directory.
Add's a new method,
SMODS.load_file(path, id)
. This method take's in a path, relative to the mod's main directory, and optinally the mod id (will use SMODS.current_mod if not. Just got thinking should I require the mod object instead of the id?). It then reads the file and loads it. Return type is the same as love.filesystem.load and loadfile.Example:
Main.lua
Loaded.lua