Built-ins
Built-in Functions Available in kutils Lua Modules
Kutils provides a few built in functions that are available at runtime from Lua. These are some functions the are necessary for being able to do anything in the lua script, like requireJVM
or just utility to make life easier, like registerHudRenderer
. These are the currently available built-ins in the kutils runtime:
requireJVM
Imports Java and Kotlin classes into the Lua script.
createLogger
Initializes a Minecraft logger with a custom prefix.
registerHudRenderer
Registers a HUD render callback to draw custom UI.
runOnMain
Executes code on the main Minecraft thread.
isEnabled
Returns true if the current script is enabled by the user.
onDisable
Takes in a function that will be called as cleanup when the user disables this module.
createLogger
Initializes a Minecraft logger with a custom prefix:
-- crates a logger with the supplied prefix log = createLogger("built-in showcase") -- the retuned logger implements 4 logging levels log.info("This is typical info") log.warn("Something shouldn't have happened") log.error("We messed up big time") log.debug("Only visible in the seperate debug.log")
registerHudRenderer
Registers a HUD render callback to draw anything to the HUD, more info on how to draw UI in Minecraft here:
local function renderHud(drawContext, tickDelta) -- Draw like you would in a normal mod end registerHudRenderer(renderHud) -- register the rendering callback
Last updated