-
Notifications
You must be signed in to change notification settings - Fork 18
Callbacks
qqtnn edited this page Jun 1, 2024
·
1 revision
on_render()
Note
All graphics-related elements (images, circles, rectangles, text) must be placed inside this callback.
on_update()
Note
Ideal for most game logics and spell casts.
on_pre_tick()
Note
Designed for logics requiring anticipation of the next game tick.
on_render_menu()
Note
All menu elements must be rendered in this callback. [!WARNING] All menu elements id must be unique otherwise they will overlap with other menu elements at saving.
local developer_id = "rename_me";
local check_test = checkbox:new(true, get_hash("developer_id .. "check_test"))
local function my_render_menu()
check_test:render("Test Checkbox", "");
end
-- register your local function into the callback
on_render_menu(my_render_menu;
on_key_press()
on_key_release()
Note
Triggers when any key is either press or released.
Register callback into anonimous function
on_key_release(function(key)
print("Key Released:", key);
end);
Register callback into a local function
local function my_on_key_press(key)
if key == 0x01 then
console.print("Key Pressed is LMB");
end;
end
on_key_press(my_on_key_press);