Vendetta/API/require

From Quasar-RCE
Revision as of 15:44, 3 March 2025 by Wikiadmin (talk | contribs) (added require)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Definition

lib.require (requirements, callback) :: nil

Description

Delays a function from executing until the requirements are met.

Arguments

  1. table requirements: A list of {mod_IDs, mod_versions} that must be met; these must be loaded and activated, not just present.
  2. function callback: The function to be executed if/when all requirements are fulfilled.

Returns

  1. nil

Other notes

  • Added in LME 2.x (Neoloader indev)
  • This function provides a method to introduce "soft dependencies" - extended functionality for mods that your plugin can utilize but aren't neccesary for its load state.
  • The function lib.check_queue is called every time a mod is activated; it is this function that tests if the dependency table provided has been met or not, utilizing lib.resolve_dep_table
  • If you need to make a range of versions valid, add a key ver_max="version" to the table. the previous version="version" will become a minimum requirement.