Vendetta/API/block trap

From Quasar-RCE
Revision as of 06:37, 3 March 2025 by Wikiadmin (talk | contribs) (Created block_trap)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Definition

lib.block_trap (id, version, run_func) :: nil

Description

Catches errors caused when running the given function and modifies the calling mod's state.

Arguments

  1. string id: name of the mod to be activated, or the INI file
  2. string version: version of the mod to be activated, or ignored if the ID is an INI file.
  3. run_func: the function to trap errors from

Returns

  1. nil

Other notes

  • This function is a ‘lazy pcall alternative’; effectively, combining pcall on the given function with lib.update_state on the calling plugin. If the pcall errors out, the owning plugin will be marked as having errored out.