> For the complete documentation index, see [llms.txt](https://docs.cherax.vip/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cherax.vip/lua-documentation.md).

# Lua Documentation

- [API Reference](https://docs.cherax.vip/lua-documentation/api-reference.md)
- [Classes](https://docs.cherax.vip/lua-documentation/api-reference/classes.md): Some classes that are automatically imported when loading a script.
- [vec2](https://docs.cherax.vip/lua-documentation/api-reference/classes/vec2.md)
- [vec3](https://docs.cherax.vip/lua-documentation/api-reference/classes/vec3.md)
- [g\_lua](https://docs.cherax.vip/lua-documentation/api-reference/g_lua.md)
- [register](https://docs.cherax.vip/lua-documentation/api-reference/g_lua/register.md): This function has to be called exactly once at the beginning of your script.
- [unregister](https://docs.cherax.vip/lua-documentation/api-reference/g_lua/unregister.md): This function indicates that the script wants to be unloaded.
- [load\_lua](https://docs.cherax.vip/lua-documentation/api-reference/g_lua/load_lua.md): Loads a lua and executes it.
- [g\_memory](https://docs.cherax.vip/lua-documentation/api-reference/g_memory.md)
- [get\_base\_address](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/get_base_address.md): Returns the base address for the given module.
- [scan\_pattern](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/scan_pattern.md): Scans the module for a specific IDA-Style pattern. Returns the address of the scan result.
- [rip](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/rip.md): Reads an offset from the instruction and returns the resulting address.
- [allocate](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/allocate.md): Allocated given bytes and return a pointer to the memory. Do not forget to free the memory after using it.
- [free](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/free.md)
- [write\_byte](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/write_byte.md)
- [write\_short](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/write_short.md)
- [write\_int](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/write_int.md)
- [write\_long\_long](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/write_long_long.md)
- [write\_float](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/write_float.md)
- [write\_double](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/write_double.md)
- [write\_string](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/write_string.md)
- [read\_byte](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/read_byte.md)
- [read\_short](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/read_short.md)
- [read\_int](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/read_int.md)
- [read\_long\_long](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/read_long_long.md)
- [read\_float](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/read_float.md)
- [read\_double](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/read_double.md)
- [read\_string](https://docs.cherax.vip/lua-documentation/api-reference/g_memory/read_string.md)
- [g\_logger](https://docs.cherax.vip/lua-documentation/api-reference/g_logger.md)
- [log\_info](https://docs.cherax.vip/lua-documentation/api-reference/g_logger/log_info.md): Logs given text to the cherax console.
- [g\_gui](https://docs.cherax.vip/lua-documentation/api-reference/g_gui.md): Options to communicate with the default gui.
- [is\_open](https://docs.cherax.vip/lua-documentation/api-reference/g_gui/is_open.md): Returns whether the main cherax windo is opened or not.
- [open](https://docs.cherax.vip/lua-documentation/api-reference/g_gui/open.md): opens the GUI
- [close](https://docs.cherax.vip/lua-documentation/api-reference/g_gui/close.md): closes the GUI
- [toggle](https://docs.cherax.vip/lua-documentation/api-reference/g_gui/toggle.md): toggles the GUI
- [add\_toast](https://docs.cherax.vip/lua-documentation/api-reference/g_gui/add_toast.md): Adds a notifcation on the top right corner.
- [add\_button](https://docs.cherax.vip/lua-documentation/api-reference/g_gui/add_button.md): Adds a button to one of the main cherax child windows. The name can be obtained by right clicking on the child.
- [add\_toggle](https://docs.cherax.vip/lua-documentation/api-reference/g_gui/add_toggle.md): Adds a toggle to one of the main cherax child windows. The name can be obtained by right clicking on the child.
- [add\_input\_int](https://docs.cherax.vip/lua-documentation/api-reference/g_gui/add_input_int.md): Adds an integer input field to one of the main cherax child windows. The name can be obtained by right clicking on the child.
- [add\_input\_float](https://docs.cherax.vip/lua-documentation/api-reference/g_gui/add_input_float.md): Adds a float input field to one of the main cherax child windows. The name can be obtained by right clicking on the child.
- [add\_input\_string](https://docs.cherax.vip/lua-documentation/api-reference/g_gui/add_input_string.md)
- [g\_hooking](https://docs.cherax.vip/lua-documentation/api-reference/g_hooking.md)
- [register\_D3D\_hook](https://docs.cherax.vip/lua-documentation/api-reference/g_hooking/register_d3d_hook.md): Registers a function which gets called on every frame. It returns an ID used for unregistering the hook.
- [register\_wndproc\_hook](https://docs.cherax.vip/lua-documentation/api-reference/g_hooking/register_wndproc_hook.md): Registers a function which gets called on every input. It returns an ID used for unregistering the hook.
- [register\_scripted\_game\_event\_hook](https://docs.cherax.vip/lua-documentation/api-reference/g_hooking/register_scripted_game_event_hook.md): Registers a function which gets called on every received scripted game event. It returns an ID used for unregistering the hook. Hoook should either return true or false.
- [unregister\_hook](https://docs.cherax.vip/lua-documentation/api-reference/g_hooking/unregister_hook.md): Removes hook by given id.
- [g\_math](https://docs.cherax.vip/lua-documentation/api-reference/g_math.md)
- [sin](https://docs.cherax.vip/lua-documentation/api-reference/g_math/sin.md)
- [cos](https://docs.cherax.vip/lua-documentation/api-reference/g_math/cos.md)
- [tan](https://docs.cherax.vip/lua-documentation/api-reference/g_math/tan.md)
- [g\_util](https://docs.cherax.vip/lua-documentation/api-reference/g_util.md)
- [yield](https://docs.cherax.vip/lua-documentation/api-reference/g_util/yield.md): If executed within scripting thread, the thread will be paused for the given time.
- [is\_session\_started](https://docs.cherax.vip/lua-documentation/api-reference/g_util/is_session_started.md): Returns whether the player is in an online session or not.
- [get\_selected\_player](https://docs.cherax.vip/lua-documentation/api-reference/g_util/get_selected_player.md): Returns the current selected player in the player list of the menu.
- [trigger\_script\_event](https://docs.cherax.vip/lua-documentation/api-reference/g_util/trigger_script_event.md)
- [get\_menu\_version](https://docs.cherax.vip/lua-documentation/api-reference/g_util/get_menu_version.md): Returns the current menu version.
- [joaat](https://docs.cherax.vip/lua-documentation/api-reference/g_util/joaat.md)
- [play\_wav\_file](https://docs.cherax.vip/lua-documentation/api-reference/g_util/play_wav_file.md)
- [g\_imgui](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui.md): All of these functions can only be executed within a D3D hook. https://github.com/ocornut/imgui
- [Globals](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/globals.md): Flags used by ImGui.
- [get\_display\_size](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/get_display_size.md)
- [set\_next\_window\_size](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/set_next_window_size.md)
- [set\_next\_window\_pos](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/set_next_window_pos.md)
- [get\_window\_size](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/get_window_size.md)
- [get\_window\_pos](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/get_window_pos.md)
- [push\_style\_var](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/push_style_var.md): Pushes a style onto the stack.
- [pop\_style\_var](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/pop_style_var.md): Pops a style from the stack.
- [begin\_window](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/begin_window.md)
- [end\_window](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/end_window.md)
- [begin\_child](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/begin_child.md)
- [end\_child](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/end_child.md)
- [same\_line](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/same_line.md)
- [new\_line](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/new_line.md)
- [separator](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/separator.md)
- [columns](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/columns.md)
- [next\_column](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/next_column.md)
- [set\_column\_offset](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/set_column_offset.md)
- [is\_item\_hovered](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/is_item_hovered.md): Returns whether the last item is being hovered by the mouse or not.
- [add\_line](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_line.md)
- [add\_circle](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_circle.md)
- [add\_circle\_filled](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_circle_filled.md)
- [add\_rect](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_rect.md)
- [add\_rect\_filled](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_rect_filled.md)
- [set\_next\_item\_width](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/set_next_item_width.md)
- [get\_content\_region\_avail](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/get_content_region_avail.md)
- [add\_button](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_button.md)
- [add\_checkbox](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_checkbox.md)
- [add\_input\_string](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_input_string.md)
- [add\_input\_string\_with\_hint](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_input_string_with_hint.md)
- [add\_text](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_text.md)
- [add\_triangle](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_triangle.md)
- [add\_triangle\_filled](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/add_triangle_filled.md)
- [begin\_main\_menu\_bar](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/begin_main_menu_bar.md)
- [end\_main\_menu\_bar](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/end_main_menu_bar.md)
- [begin\_menu](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/begin_menu.md)
- [end\_menu](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/end_menu.md)
- [menu\_item](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/menu_item.md)
- [begin\_tab\_bar](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/begin_tab_bar.md)
- [end\_tab\_bar](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/end_tab_bar.md)
- [begin\_tab\_item](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/begin_tab_item.md)
- [end\_tab\_item](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/end_tab_item.md)
- [open\_popup](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/open_popup.md)
- [close\_current\_popup](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/close_current_popup.md)
- [is\_popup\_open](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/is_popup_open.md)
- [begin\_popup](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/begin_popup.md)
- [end\_popup](https://docs.cherax.vip/lua-documentation/api-reference/g_imgui/end_popup.md)
- [g\_os](https://docs.cherax.vip/lua-documentation/api-reference/g_os.md)
- [time](https://docs.cherax.vip/lua-documentation/api-reference/g_os/time.md)
- [time\_ms](https://docs.cherax.vip/lua-documentation/api-reference/g_os/time_ms.md)
- [finger\_print](https://docs.cherax.vip/lua-documentation/api-reference/g_os/finger_print.md): Returns a string that is unique on every pc.
- [NATIVES](https://docs.cherax.vip/lua-documentation/api-reference/natives.md)
- [POOL](https://docs.cherax.vip/lua-documentation/api-reference/natives/pool.md)
- [PLAYER](https://docs.cherax.vip/lua-documentation/api-reference/natives/player.md)
- [SYSTEM](https://docs.cherax.vip/lua-documentation/api-reference/natives/system.md)
- [CAM](https://docs.cherax.vip/lua-documentation/api-reference/natives/cam.md)
- [DECORATOR](https://docs.cherax.vip/lua-documentation/api-reference/natives/decorator.md)
- [WORLDPROBE](https://docs.cherax.vip/lua-documentation/api-reference/natives/worldprobe.md)
- [STATS](https://docs.cherax.vip/lua-documentation/api-reference/natives/stats.md)
- [CLOCK](https://docs.cherax.vip/lua-documentation/api-reference/natives/clock.md)
- [FIRE](https://docs.cherax.vip/lua-documentation/api-reference/natives/fire.md)
- [STREAMING](https://docs.cherax.vip/lua-documentation/api-reference/natives/streaming.md)
- [CUTSCENE](https://docs.cherax.vip/lua-documentation/api-reference/natives/cutscene.md)
- [WATER](https://docs.cherax.vip/lua-documentation/api-reference/natives/water.md)
- [AUDIO](https://docs.cherax.vip/lua-documentation/api-reference/natives/audio.md)
- [INTERIOR](https://docs.cherax.vip/lua-documentation/api-reference/natives/interior.md)
- [TASK](https://docs.cherax.vip/lua-documentation/api-reference/natives/task.md)
- [CONTROL](https://docs.cherax.vip/lua-documentation/api-reference/natives/control.md)
- [NETWORK](https://docs.cherax.vip/lua-documentation/api-reference/natives/network.md)
- [OBJECT](https://docs.cherax.vip/lua-documentation/api-reference/natives/object.md)
- [ENTITY](https://docs.cherax.vip/lua-documentation/api-reference/natives/entity.md)
- [VEHICLE](https://docs.cherax.vip/lua-documentation/api-reference/natives/vehicle.md)
- [WEAPON](https://docs.cherax.vip/lua-documentation/api-reference/natives/weapon.md)
- [SCRIPT](https://docs.cherax.vip/lua-documentation/api-reference/natives/script.md)
- [PED](https://docs.cherax.vip/lua-documentation/api-reference/natives/ped.md)
- [MISC](https://docs.cherax.vip/lua-documentation/api-reference/natives/misc.md)
- [GAMEPLAY](https://docs.cherax.vip/lua-documentation/api-reference/natives/gameplay.md)
- [UI](https://docs.cherax.vip/lua-documentation/api-reference/natives/ui.md)
- [GRAPHICS](https://docs.cherax.vip/lua-documentation/api-reference/natives/graphics.md)
- [MOBILE](https://docs.cherax.vip/lua-documentation/api-reference/natives/mobile.md)
