Discord

Preparing your files

Please wait until the download is ready.

Luka's Scripting Utilities

Luka's Scripting Utilities

by Luka S.J.

A pack full of various scripting utilities to ease your development!

v4.1.135,194
Download144 KB

Plugin Manager Helpers

LUTS extends Essentials' PluginManager and Console modules and ships a
mixin for safely composing plugins.

PluginManager

  • PluginManager.find_dir(plugin) returns the directory of an installed plugin by matching its name against the meta.txt files in the Plugins folder (or nil if not found)
dir = PluginManager.find_dir("Luka's Scripting Utilities")

Console echo helpers

Markup-aware echo helpers added to the Console module:

  • Console.echo_str(msg, options = {}) echo without a line break, applying markup / styling
  • Console.echo_p(msg, options = {}) echo with a line break (paragraph)

These pair with the String colour tags ("text".red, .green, …) from the
core extensions.

Aliaser

PluginManager::Aliaser is a mixin that bulk-aliases overlapping methods when
you prepend a module — letting a plugin override base methods while keeping the
originals callable. Include it in a class, then:

  • alias_with_module(alias_module, extension = 'old') prepend alias_module and auto-alias every overlapping instance, private and class method. Each original method is preserved under {name}_{extension} (e.g. updateupdate_old).
  • map_methods_for_alias(alias_module) the instance/private methods present in both the base class and the module
  • map_class_methods_for_alias(alias_module) the class methods present in both
class MyScene
  extend PluginManager::Aliaser
  alias_with_module(MyScenePatch, 'legacy')
  # MyScene#update is preserved as #update_legacy; MyScenePatch#update takes over
end

Class methods are matched against the module's nested ClassMethods, and an
existing alias is never overwritten. This is the mechanism that lets multiple
LUTS-based plugins layer behaviour on the same class without clobbering one
another.