Ultrastar Deluxe Plugin Interface
Ultrastar Deluxe 1.1 plugins are scripts written in lua. For descriptions of the language syntax and the language itself please visit http://www.lua.org
Every plugin that is loaded by Ultrastar gets its own lua state, therefore there can not be any conflicts with names of variables or functions (that are in fact variables too ;).
Ultrastar Specific
Ultrastar tries to load all files in the „plugins“ folder with the extension „.usdx“. If you would like to seperate your plugin in different files, name only the main file “*.usdx“ and give the other script files extensions like „.lua“. Script files can either be stored in text form or in precompiled form.
There should be no code outside of functions, because this code will be called before the state is prepared (that means there is no lib loaded into the state and basic globals are missing). This code couldn't even load libs with require.
The first function that is called by Ultrastar Deluxe is „plugin_init()“. It has to be defined, it has to call the register function and it has to return true, otherwise the plugin will imediatly be unloaded.
By default only the base and package libs are loaded into the lua state of a plugin. But you can load other libs with „require(module name)“. Module name can be one of the following:
• „string“ - the string manipulation library will be loaded
• „table“ - table manipulation library will be loaded
• „math“ - mathematical functions (sin, log, etc.) library will be loaded
• „os“ - operating system facilities library will be loaded
You can also load Ultrastar Deluxe specific libs with require, these are marked with the prefix „usdx.“ e.g. require(usdx.log) will load the log library. For a list of all libraries and their functions read below.
The register function
Syntax: register(name, version, [author], [homepage])
This function reports some information from the plugin to Ultrastar Deluxe. It can only be called once, after the first call Register will be undefined and another call would raise an error. Name should be a unique name for the plugin, version should be a string like „1.01“. So that a string comparison of a new version should report that the newer version is greater.
inkrus