Ulysses

Ulysses Stuff => Ulysses Release Archives => Releases => Releases for ULib v1.* => Topic started by: fackelkind on August 20, 2006, 09:44:59 PM

Title: ULib v1.01 Modules Loader
Post by: fackelkind on August 20, 2006, 09:44:59 PM
Okay, this is nothing big, but perhaps usefull. I added the old module function to ULib, allows you to execute scripte after ULib has loaded.

Code: [Select]
if not ULib then
        _OpenScript ("lua/ULib/init.lua")
end

if ULib then
        if _file.Exists ("lua/ULib/modules") then
                local files = _file.Find ("lua/ULib/modules/ulx_*.lua")

                _Msg ("=== ULX Modul Loader =================================================\n")
                _Msg ("=                                                                    =\n")
                for v in files do
                        _Msg ("= " .. files[v] .. string.rep (" ", 67 - string.len (files[v])) .. "=\n");
                        _OpenScript ("lua/ULib/modules/" .. files[v])
                end
                _Msg ("=                                                                    =\n")
                _Msg ("======================================================================\n")
        end
end

Put this into your lua/init folder (I called it ulx_modules.lua)


Title: Re: ULib v1.01 Modules Loader
Post by: JamminR on August 27, 2006, 05:15:42 PM
Nice job fackelkind! I was just wondering to myself last week that there was no similiar function for ULib
Title: Re: ULib v1.01 Modules Loader
Post by: spbogie on August 28, 2006, 01:51:18 PM
There is a reason that there is no modules loader function in ULib. It's because you simply use _OpenScript("ULib/init.lua") at the begining of your script instead. ULib automaticly checks to make sure it doesn't get loaded a second time.
Title: Re: ULib v1.01 Modules Loader
Post by: JamminR on August 29, 2006, 08:23:39 PM
Spbogie,
 True, but I hate loading my init folder full of scripts, ULX related or not.
This way, I can put the scripts related to ULX into a subfolder of Ulib (or wherever else I might like and edit the original loader script)
But, I like to keep things as neat as possible, easier to know where stuff is