Professional Lua plugin system for game modification and analysis.
- Framework:
_ui_framework.luaprovides the core UI system - Plugins: Individual
.luafiles that register with the framework - Loading Order: Files prefixed with
_load first (framework files) - Hot Reload: Use
[INSERT]→Unloadbutton to reload plugins
--- Plugin metadata
---@meta
--- Description
--- @module plugin_name
--- @version 1.0.0
local M = {}
-- Configuration
local cfg = {
enabled = true,
-- ...
}
-- Hooks
sdk.on_frame(function()
-- Frame update logic
end)
sdk.on_key_down(function(vk)
-- Key handling
return false -- not consumed
end)
-- UI Panel
local function draw_panel()
TOOLS_UI.header("Plugin Name")
TOOLS_UI.checkbox("Enable", cfg, "enabled", "Tooltip")
end
-- Registration
if _G.TOOLS_UI then
TOOLS_UI.register_panel("plugin_id", "Plugin Name", draw_panel)
end
-- Lifecycle
sdk.on_load(function()
sdk.log_info("Plugin loaded")
end)
sdk.on_unload(function()
sdk.log_info("Plugin unloaded")
end)
return Msdk.on_frame(fn)— Called every framesdk.on_overlay(fn)— Called during overlay rendering
sdk.on_key_down(fn(vk))— Key press, returntrueto consumesdk.on_key_up(fn(vk))— Key release
sdk.on_gl_identity(fn)— InterceptglLoadIdentitysdk.on_glu_lookat(fn(...))— InterceptgluLookAt, returntrueto consume
sdk.on_load(fn)— Plugin loadedsdk.on_unload(fn)— Plugin unloading
TOOLS_UI.header(text)— Section headerTOOLS_UI.subheader(text)— Subsection headerTOOLS_UI.status_badge(active, on?, off?)— Status indicatorTOOLS_UI.keybind(key, desc)— Keybind displayTOOLS_UI.group_begin(label)/TOOLS_UI.group_end()— Styled group
TOOLS_UI.checkbox(label, tbl, key, tip?)— Boolean toggleTOOLS_UI.slider_float(label, tbl, key, min, max, tip?)— Float sliderTOOLS_UI.drag_float(label, tbl, key, speed, min, max, tip?)— Float dragTOOLS_UI.slider_int(label, tbl, key, min, max, tip?)— Integer sliderTOOLS_UI.color_edit4(label_rgb, label_alpha, color_tbl)— Color pickerTOOLS_UI.action_button(label, tip?)— Clickable button
TOOLS_UI.register_panel(id, title, draw_fn)— Register panelTOOLS_UI.unregister_panel(id)— Unregister panelTOOLS_UI.safe_call(fn, ...)— Safe function execution
sdk.log_info(msg)sdk.log_warn(msg)sdk.log_error(msg)
sdk.is_key_down(vk)→booleansdk.get_cursor_pos()→x, ysdk.set_cursor_pos(x, y)sdk.show_cursor(show)sdk.send_chars(text)
sdk.get_window_rect()→left, top, right, bottom
sdk.gl_enable(cap)/sdk.gl_disable(cap)sdk.gl_depth_mask(flag)sdk.gl_blend_func(sfactor, dfactor)sdk.gl_line_width(width)sdk.gl_color4f(r, g, b, a)sdk.gl_polygon_mode(face, mode)sdk.gl_push_attrib(mask)/sdk.gl_pop_attrib()sdk.gl_push_matrix()/sdk.gl_pop_matrix()sdk.gl_mult_matrix_d(matrix)sdk.gl_apply_lookat(...)sdk.gl_begin(mode)/sdk.gl_end()sdk.gl_vertex3f(x, y, z)
gmath.radians(deg)→radgmath.degrees(rad)→deggmath.sin(x),gmath.cos(x),gmath.tan(x)gmath.normalize(x, y, z)→nx, ny, nzgmath.cross(ax, ay, az, bx, by, bz)→cx, cy, czgmath.clamp(value, min, max)→clampedgmath.mod(value, mod)→result
VK.*— Virtual key codes (e.g.,VK.F1,VK.SPACE)GL.*— OpenGL constants (e.g.,GL.DEPTH_TEST,GL.BLEND)
local ok, err = TOOLS_UI.safe_call(function()
-- Risky operation
end)
if not ok then
sdk.log_error("Operation failed: " .. tostring(err))
endsdk.on_unload(function()
-- Cleanup resources
if state.mouse_look then
sdk.show_cursor(true)
end
end)-- Cache frequently accessed values
local is_key_down = sdk.is_key_down
local VK_SHIFT = VK.SHIFT
sdk.on_frame(function()
if is_key_down(VK_SHIFT) then
-- Fast check
end
end)if type(cfg.speed) ~= "number" then
sdk.log_error("Invalid speed configuration")
return
endThis plugin system leverages modern Lua features:
- Type annotations via LuaLS
- Error handling with
xpcallanddebug.traceback - Performance with local variable caching
- Safety with input validation
- Modularity with proper module pattern
See included plugins:
cheats.lua— Cheat code systemfreecam.lua— Free camera with WASD + mouse lookwallhack.lua— Visual overlay modesworld_grid.lua— 3D reference grid
- Place shared plugins in
lua/(deployed to each game's runtimeplugins/) - Launch game
- Press
[INSERT]to open UI - Check logs for errors
sdk.log_info(string.format("Debug: %s", tostring(value)))[INSERT]— Toggle UI- Plugin-specific hotkeys defined in each plugin
MIT License — See project root for details.