arrow-left

Only this pageAll pages
gitbookPowered by GitBook
triangle-exclamation
Couldn't generate the PDF for 149 pages, generation stopped at 100.
Extend with 50 more pages.
1 of 100

CS2 Lua API

Loading...

Introduction

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Workshop

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

API

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Overview

hashtag
Official lua API documentation for fatality.winarrow-up-right​

Examples

hashtag
Hello, fellow developer!

In this section, you'll find Lua examples that you can use to learn about our API. Please note that these examples don't cover the entirety of the API itself, so you'll have to do some exploration by yourself!

Instances

Types

In this section, the most common renderer types are listed, that are not particularly bound to a specific part of the renderer.

circle-info

Use the left menu (or hamburger menu on mobile) to navigate between types.

Creating scripts

hashtag
Welcome to the basics of scripting with our API.

Fatality’s API is designed to mirror the software’s internal structure, giving you substantial control over its subsystems. Some features that could cause instability or damage are restricted.

hashtag
Basic Concepts

Our scripting engine uses LuaJIT 2.1 (with minor customizations). It’s fully compatible with Lua 5.1 and includes some Lua 5.2 enhancements.

The standard libraries baselib, bit, ffi, math, string and table are available. Note that the ffi library is only available if the Allow insecure option is enabled. Refer to for more details.

If we ever modify any standard functions, we will document those changes to keep you informed.

hashtag
Documentation Overview

Throughout the API reference, you’ll encounter various labels used to describe a certain method or a field.

hashtag
Labels:

Field Function Method Constructor Read only Insecure only Overridable

All the possible labels are listed above.

  • Field: this label indicates that the item is a standard field. It's type will be explained just below the name.

  • Function: this label indicates that the item is a function, which you call using a dot syntax (obj.fn()).

hashtag
Argument and return lists

Arguments and return values are listed in the exact order you must supply or capture them. For instance, if a parameter is shown first, it is to be passed as the first argument to the function. The same goes for return values: the first listed value will be placed in the first variable you declare, and so on.

hashtag
Types

Some type descriptions have special symbols in place:

  • type? means that the type might be nil.

  • type<other> means that inner methods or fields will use other type.

hashtag
Rules

To keep your scripts safe and easy to use, we have quite a lot of safety measures in place. But, due to how specific stuff works, we are unable to fully make it as safe as possible. Therefore, here are some notes you should know before writing scripts:

hashtag
You Control the Lua State

You may replace or override API functions, but you’re responsible for maintaining stable behavior. If you encounter any bugs in the default API (excluding FFI), please report them so we can address the issue.

hashtag
Prioritize Safety

Using FFI grants you extensive freedom. Keep in mind that scripts which could harm users in any way are disallowed and will be removed. Whenever possible, rely on the provided API or request additional functionality if you need something not currently offered. Custom “script loaders” are strictly disallowed.

hashtag
Keep the Software Usable

Avoid hiding unrelated UI elements, obstructing user input, or interfering with the overall user experience. Scripts that disrupt functionality or harass users risk removal from the Workshop.

Publishing Tool

Welcome to the Publishing Tool documentation.

  • Creating a script:

  • Using branches:

Bundled Assets

If you want to include additional files with your script (e.g. sounds, images, or data), you can bundle them inside a ZIP archive with a defined structure.

  • The archive must contain a script.lua file in the root.

  • The archive must not contain a scripts/remote/ directory or any files inside it.

ConVar

Represents a convar used by the game.

hashtag
name

FieldRead only

Type: string

CPlane

Encapsulates the plane information in the trace object.

hashtag
normal

FieldRead only

Type:

mods

Usage: mods.{mod_name}

This table exposes several mods (short for Module, not Modification), that Fatality uses to operate.

hashtag
events

OutlineMode

This enum is used to determine the outline mode for outlined shapes.

hashtag
INSET

Field

Inset outlining. This means that the outline will be inside the shape (+1px from top-left, -1px from bottom-right).

RenderMode

This enum is used to toggle rendering modes.

hashtag
NORMAL

Field

Normal, opaque rendering. All polygons will get filled with color, and texture sampling will be fully supported. This is the default mode to render shapes in layer.

All bundled assets are automatically installed to a directory chosen by the API engine. See ws for usage details.


hashtag
description

FieldRead only

Type: string


hashtag
flags

FieldRead only

Type: int


hashtag
value

FieldRead only

Type: <type>

The value of the convar represented in its type


hashtag
OUTSET

Field

Outset outlining. This means that the outline will be outside of the shape (-1px from top-left, +1px from bottom-right).


hashtag
CENTER

Field

Center outlining. This means that the outline will match the shape size.


hashtag
WIREFRAME

Field

Wireframe rendering. This means that the polygons will no longer be filled with color, nor texture sampling will ever work.

Field

Type: Events_t

Event manager. Use this mod if you want to listen to more in-game events.

Method: this label indicates that the item is a method, which is also a function, but it's advised to call it with the colon syntax (obj:fn()).

  • Constructor: this label indicates that the item is a constructor definition. You don't have to call any field in particular, but instead you must invoke the type itself (example: vector has __call, meaning you should invoke it like this: vector()).

  • Read Only: this label indicates that the item is read only, and it's value cannot be changed. Typically, this restriction does not extend to any child elements.

  • Insecure only: this label indicates that the item is only available if the insecure mode is turned on.

  • Overridable: this label indicates that the method, can be overridden by the developer and its parent type will inherit any functionalities.

  • <other> means that the type will be either other, or any of its child types.
    the official Lua documentationarrow-up-right

    Guidelines

    All items published on the Storefront must follow these guidelines to keep the Workshop safe, usable, and fair for everyone.

    hashtag
    1. Provide meaningful descriptions

    Your description should clearly explain what the item does, what it requires, and any limitations it may have. Do not use vague, misleading, or clickbait-style descriptions. End users should know exactly what they are getting before they subscribe to or purchase an item.

    hashtag
    2. Make meaningful and unique items

    Trivial one-line scripts, spam items, commonly made items that don't provide anything new or submissions with no truly meaningful functionality are not allowed. Workshop content should be fresh and interesting for the users, so all items must undergo a quality assurance to ensure they're not polluting the workshop with junk content.

    hashtag
    3. Respect capability requests

    Always use the provided APIs and tools in a way that respects user choice of permissions. Do not attempt to bypass or override capability restrictions. If your item does not need filesystem access, for example, you must not request it.

    hashtag
    4. Practice fair market behavior

    Artificial price dumping, manipulative pricing strategies, or exploitative sales tactics are not allowed. The Workshop should remain a healthy, competitive, and sustainable marketplace for all developers.

    hashtag
    5. Do not publish malicious code

    This includes malware, exploits, spyware, or any script designed to harm users or their systems. While beta branches exist for unverified testing, all items submitted to live must be safe and secure. Any attempt to sneak in harmful code will result in removal and possible bans.

    hashtag
    6. Ensure compatibility with existing features

    Scripts and configs must not intentionally disrupt core software features, other Workshop items, or the overall stability of the platform. If your item modifies functionality, it must do so safely and predictably.

    hashtag
    7. Keep content respectful

    Item names, descriptions, scripts, and configs must not contain harassment, hate speech, targeted attacks, or inappropriate material. All content must follow the same standards as the forum and community guidelines.

    hashtag
    8. Maintain and update your items

    If your script or config breaks due to updates in the core software or APIs, you are responsible for updating it. If you choose to stop maintaining an item, you must clearly mark it as deprecated so users are not misled.

    hashtag
    9. Be transparent with monetization

    Paid items must disclose exactly what features are included. You may not hide critical functionality behind unexpected paywalls or release crippled versions that require additional payment to work as advertised.

    hashtag
    10. Respect licensing and attribution

    If your item uses external code, libraries, or assets, you are responsible for ensuring that you follow their licensing terms. Proper credit must be given where required, and you may not repackage or sell work you do not have rights to.

    Rounding

    hashtag
    Rounding

    Last modified: 03 January 2025

    This enum is used to determine the rounding for rounded shapes.

    hashtag
    TL

    Field

    Round top-left corner.


    hashtag
    TR

    Field

    Round top-right corner.


    hashtag
    BL

    Field

    Round bottom-left corner.


    hashtag
    BR

    Field

    Round bottom-right corner.


    hashtag
    T

    Field

    Round both of the top corners. This produces the same result as using bit.bor(draw.Rounding.TL, draw.Rounding.TR).


    hashtag
    L

    Field

    Round both of the left corners. This produces the same result as using bit.bor(draw.Rounding.TL, draw.Rounding.BL).


    hashtag
    R

    Field

    Round both of the right corners. This produces the same result as using bit.bor(draw.Rounding.TR, draw.Rounding.BR).


    hashtag
    B

    Field

    Round both of the bottom corners. This produces the same result as using bit.bor(draw.Rounding.BL, draw.Rounding.BR).


    hashtag
    ALL

    Field

    Round all corners. This produces the same result as using bit.bor(draw.Rounding.TL, draw.Rounding.TR, draw.Rounding.BL, draw.Rounding.BR).

    TextAlignment

    This enum determines how to align the text when drawing it.

    circle-info

    left and top, as well as right and bottom are interchangeable. It means that if you use left for vertical alignment, it will produce exactly the same result as using top, and vice versa. top/bottom are here only for the sake of convenience and readability.

    hashtag
    LEFT

    Field

    Align left. It will mean that the text position's X coordinate is located at the left side of the text area.


    hashtag
    CENTER

    Field

    Align center. It will mean that the text position's X (or Y) coordinate is located at the center of the text area.


    hashtag
    RIGHT

    Field

    Align right. It will mean that the text position's X coordinate is located at the right side of the text area.


    hashtag
    TOP

    Field

    Align top. It will mean that the text position's Y coordinate is located at the top side of the text area.


    hashtag
    BOTTOM

    Field

    Align bottom. It will mean that the text position's Y coordinate is located at the bottom side of the text area.

    FontFlags

    This enum determines which flags a font object should possess. Setting those flags is only possible during type construction.


    hashtag
    SHADOW

    Field

    Adds a 1px shadow to font glyphs.


    hashtag
    OUTLINE

    Field

    Adds a 1px outline to font glyphs.


    hashtag
    ANTI_ALIAS

    Field

    Enable antialiasing on font glyphs. This flag only works on GDI fonts.


    hashtag
    NO_DPI

    Field

    Disable DPI scaling on this font. By default, font glyphs will be scaled in accordance to the global DPI scale.


    hashtag
    NO_KERN

    Field

    Disable glyph kerning on this font.


    hashtag
    MONO

    Field

    Enables a strong hinting algorithm for rasterization. Only works on FreeType fonts.


    hashtag
    LIGHT

    Field

    Enables a light hinting algorithm for rasterization. Only works on FreeType fonts.

    CFiringMode

    Firing mode information.

    hashtag
    values_arr

    FieldRead only

    Type: <type>

    Values.

    CSWeaponMode

    This enum represents the firing mode for a weapon.

    hashtag
    PRIMARY_MODE

    Field

    Primary mode (usually left mouse button).


    hashtag
    SECONDARY_MODE

    Field

    Secondary mode (usually right mouse button).

    Types

    In this section, the most common gui types are listed, that are not particularly bound to a specific part of the gui.

    circle-info

    Use the left menu (or hamburger menu, if you are on mobile) to navigate between types.

    Using libraries:
    Step By Step Guide
    Branches
    Libraries & Dependencies

    hashtag
    pos

    FieldRead only

    Type: Vector

    Vector

    Creating Libraries

    circle-info

    This resource only goes over the basics of library development. If you wish to learn more about libraries, please go here.

    Libraries allow users to write pre-written, reusable code that can be imported anywhere, at any time. This is useful if you often reuse portions of your code in multiple scripts, or if you wish to compartmentalize your scripts and have a cleaner code base.

    In Fatality, libraries are divided into two categories: Local libraries and Cloud libraries. Local libraries are located in your fatality/scripts/lib folder and may only be used by other local scripts, meanwhile cloud libraries are similar to cloud scripts and can be shared and imported by any other cloud script through the workshop. Despite that difference, libraries follow the same code structure:

    You may then import said library from another file using either its file name or identifier.

    Counter control

    In our Lua API, we give users the ability to make their own custom menu controls. Here's an example on how to make a simple counter:

    local Counter = {} do
      -- Create the metatable for this control.
      Counter.__index = gui.LuaControlProto()
    
      -- Specify any initial data. This is propagated to any LuaControl initialized with this metatable.
      Counter.__index.initialData = {
        counter = 0
      }
    
      -- Override any methods you wish.
      function Counter.__index:onRender(contents, scrollbar, mins, maxs)
        contents:AddRectFilled(draw.Rect(mins, maxs), draw.color.White())
    
        contents.font = draw.fonts['gui_bold']
        contents:AddText(mins + draw.Vec2(5, 5), tostring(self.data.counter), draw.color.Black())
        contents.font = nil
      end
    
      function Counter.__index:onMouseDown(key)
        if key == gui.MouseButton.LEFT then
          self.data.counter = self.data.counter + 1
          self:LockInput() -- Makes sure you can't drag the menu while clicking.
        end
      end
    
      function Counter.__index:onMouseUp(key)
        if key == gui.MouseButton.LEFT then
          self:UnlockInput() -- Makes sure you can drag menu again after clicking.
        end
      end
    
      function Counter.create(id, initialValue)
        local control = gui.LuaControl(id, Counter.__index, draw.Vec2(), draw.Vec2(0, 24)) do
          control.sizeToParentW = true -- Resizes the control to the width of the container.
          control.data.counter = initialValue or 0
          control.margin = draw.Rect(3, 7, 3, 7) -- Default control margin
        end
    
        return control
      end
    end
    
    gui.ctx:find('lua>elements a'):add(Counter.create('counter'))

    With that, you'll have an extremely simple counter that you can click on to increment.

    Getting Started

    Workshop allows you to publish, advertise, and earn from your items. It provides a broad set of features for both publishers and end users, making the storefront easy to use and reliable to manage.

    hashtag
    Core Concepts

    Before publishing, it's important to understand the key concepts used in Workshop:

    • Storefront - the main Workshop UI where users search, view, subscribe to, or purchase items;

    • Publishing Tool - the area where item authors create, update, and manage their entries in the storefront;

    • Item - a single Workshop entry. This can be a script, a library, or a config;

    • Build - a specific version of an item that gets delivered to the end user;

    • Branch - a channel that holds a single build (e.g. stable, beta);

    • Dependency - a required library that an item relies on to function;

    • Capability - a permission that unlocks restricted API functions (e.g. filesystem access, clipboard).

    hashtag
    Next Steps

    1. Read the .

    2. Complete a tutorial.

    Updating Items

    In order to update an item you need to follow these steps:

    hashtag
    Upload a new build & wait for approval

    Check on how to upload a build.

    hashtag
    Set build active

    1. Navigate to Builds and find the approved build.

    2. Click Set to branch

    3. Select Default branch

    After these actions are complete, your new build will be available for users instantly.

    triangle-exclamation

    Builds are NOT automatically set to the Default branch upon approval! Once you get the notification that your build has been approved, proceed to set its branch to Default.

    Additionally, you may want to test upcoming builds before they hit the Live item. For that, we recommend looking into .

    Branches

    Branches let you create separate versions of your items so users can test upcoming builds before they are pushed to the live Default branch.

    Open the Branches tab to manage existing branches or create new ones:

    hashtag
    Creating a branch

    Click Add branch, enter a branch title, and confirm.

    You can create as many branches as you need.

    After a branch is created, you can:

    • Add users (they’ll be allowed to opt in).

    • Set a price (makes the branch public so anyone can purchase it).

    circle-exclamation

    Note: Adding users does not automatically enable the branch for them. It only gives them the option to join.

    hashtag
    Managing Builds

    Branches can hold any builds - both verified and unverified.

    To assign a build to a branch:

    1. Go to the Builds tab.

    2. Find the build you want to assign.

    3. Click Set branch.

    This immediately makes that build available to anyone using the branch.

    Libraries & Dependencies

    Libraries are specialized items that are not visible in the Storefront. Instead, they are available for other publishers to reference inside their scripts.

    hashtag
    Creating a Library

    Creating a library works the same way as creating a script (seeStep By Step Guide).

    The only difference is that a library requires a Library ID.

    • The Library ID is a unique identifier used by scripts to reference your library.

    • Without it, other publishers cannot include your library as a dependency.

    You can create and assign a Library ID in the General tab:

    Once published and approved, your library becomes available for others to use as a dependency.

    hashtag
    Referencing Libraries

    When your script references a library, the library is automatically loaded alongside your script at runtime.

    To add a library dependency:

    1. Go to the Dependencies tab.

    2. Click Add dependency.

    3. Find the library you want to reference and click Add.

    It is recommended to reference a specific version of a library rather than always pulling the latest. This ensures your script continues to work even if the library author publishes breaking changes later.

    Event_t

    Event usertype. An instance of this type can be found in events.

    hashtag
    Add

    Method

    Adds a callback to the event.

    Arguments

    Name
    Type
    Description

    Returns

    Nothing.

    Example


    hashtag
    Remove

    Method

    Removes a callback from the event.

    Arguments

    Name
    Type
    Description

    Returns

    Nothing.

    Example

    CCSGOInput

    Usage: game.input.{field_or_method}

    This type represents the game's command input system.

    hashtag
    m_bInThirdPerson

    FieldRead only

    Type: bool

    true if currently in the third person.


    hashtag
    GetViewAngles

    Method

    Returns current camera view angles.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    SetViewAngles

    Method

    Sets new camera view angles.

    Arguments

    Name
    Type
    Description

    Returns

    Nothing.

    Example

    CInputSystem

    Usage: game.input_system:{method}

    This type represents the game's control input system.

    hashtag
    VKToButtonCode

    Method

    Converts a virtual key to button code.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example

    CGameUIFuncs

    Usage: game.gameUIFuncs:{method}

    This type represents the game's UI functions.

    hashtag
    GetBindingForButtonCode

    Method

    Returns the binding name for a button code.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example

    CCVar

    Usage:

    Usage: game.cvar:{method}

    This type represents the game's cvar system.

    hashtag
    Find

    Method

    Get the game's cvar under this name.

    Arguments

    Returns

    Example

    Ray_t

    Describes the ray type used by the tracing methods.

    hashtag
    SetHull

    Method

    Changes the shape of the ray to a box/hull, using the specified mins and maxs.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    SetSphere

    Method

    Changes the shape of the ray to a sphere, using the specified center position and radius.

    Arguments

    Returns

    Nothing.

    Example

    PenResult_t

    This type encapsulates all penetration data returned from FireBullet.

    hashtag
    damage

    Field

    The damage done by the weapon.


    hashtag
    hitgroup

    Field

    The hitgroup that was hit. May be invalid.


    hashtag
    GetHitPos

    Method

    Returns one of the bullet impacts.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    GetHitPosCount

    Method

    Returns how many bullet impacts there is.

    Arguments

    None.

    Returns

    Type
    Description

    Example

    Events_t

    Usage: mods.events.{method}

    This module lets you manage custom in-game event listener.

    triangle-exclamation

    Please note that the game server knows which events you are listening to. Internally, we only listen to events that will get sent to the client anyway in one way or another. If you decide to listen to something the server generally does not expect, it may cause issues on official servers.

    hashtag
    AddListener

    Method

    Adds a game event to the listener.

    circle-check

    Internally we listen to the following events:

    • bullet_impact

    • weapon_fire

    Arguments

    Name
    Type
    Description

    Returns

    Nothing.

    Example

    Glyph_t

    This type represents a glyph object.

    hashtag
    codepoint

    FieldRead only

    Type: int

    Character codepoint.


    hashtag
    size

    FieldRead only

    Type:

    Glyph dimensions.


    hashtag
    offset

    FieldRead only

    Type:

    Glyph offset.


    hashtag
    uv

    FieldRead only

    Type:

    UV rect on the texture atlas.

    EntityList_t

    This type represents an entity list.

    triangle-exclamation

    Never save any entities you get from this list if you don't know what you are doing! You may be left with dangling pointers, which will inevitably lead to a crash.

    hashtag
    ForEach

    Method

    Loops the entities.

    Arguments

    Returns

    Nothing.

    Example

    hashtag
    ForEachZ

    Method

    Loops the entities in the reverse order.

    Arguments

    Returns

    Nothing.

    Example

    EntityEntry_t

    Represents an entity entry.

    hashtag
    entity

    Field

    Type: <type>

    Entity instance. Type depends on the list you get it from.


    hashtag
    hadDataUpdate

    Field

    Type: bool

    true if the client had received any updates to this entity at least once.


    hashtag
    handle

    Field

    Type:

    Entity's handle. You may store this elsewhere if you need to have global access to an entity.


    hashtag
    avatar

    Field

    Type:

    circle-check

    This field is only available on entries that use C_CSPlayerController type.

    Player's profile picture. Will be nil if was yet to be initialized.


    hashtag
    visuals

    Field

    Type: PlayerEntryVisualData

    circle-check

    This field is only available on entries that use C_CSPlayerPawn type. Use only inside the playerInfoPre and playerInfoPost callbacks, otherwise you may access outdated or invalid data.

    Player's ESP information.

    Adding UI

    hashtag
    Adding UI

    Now that you know the basics, let’s extend our script by allowing the user to toggle the text. We can do this by adding a control to the menu.

    hashtag
    Creating a control

    game

    Usage: game.{interface_or_function}

    This table exposes various internal services and global objects used by Fatality, and also provides a way to retrieve any additional services you need.

    hashtag
    globalVars

    CGlobalVarsBase

    Usage:

    game.globalVars.{field}

    Usage: game.globalVars.{field}

    An instance of this type provides a way to read several global variables that are used by the game. Changing any of the values is not and will never be supported.

    Adapter

    This type represents a rendering adapter used within the rendering system.

    hashtag
    GetBackBuffer

    Method

    SvgTexture

    This type represents an SVG texture object.

    circle-info

    This type inherits type. All of its base methods and fields are also available in this type.

    triangle-exclamation

    Passing invalid SVG data to the constructor will cause a crash. We will fix this issue in future updates.

    FontGDI

    This type represents a font object. Internally, this type uses GDI library to rasterize font glyphs.

    circle-info

    This type inherits type. All of its base methods and fields are also available in this type.

    hashtag
    __call

    Managed

    This type represents a managed object. You cannot create an instance of this type directly.

    Every object, that inherits from this type, must be Created before use. The rendering system will only create them automatically, if you happen to lose a device object (e.g. minimize the game window, and then restore it) and only if you add your objects to manage table in .

    hashtag
    obj

    CCSWeaponBaseVData

    This type represents a weapon's static data.

    hashtag
    __index

    Function

    Attemps to search for a field in this class.

    CSWeaponCategory

    This enum represents the category classification for weapons in the game.

    hashtag
    OTHER

    Field

    Context

    This type represents the GUI context.

    hashtag
    Find

    Method

    Finds a control by ID.

    C_BaseCSGrenadeProjectile

    This type represents a grenade projectile.

    circle-info

    This type inherits type. All of its base methods and fields are also available in this type.

    hashtag
    GetAbsOrigin

    Represents weapons or items that don't fit into any specific category.

    hashtag
    MELEE

    Field

    Represents melee weapons, such as knives or other close-combat tools.


    hashtag
    SECONDARY

    Field

    Represents secondary weapons, such as pistols.


    hashtag
    SMG

    Field

    Represents submachine guns (SMGs).


    hashtag
    RIFLE

    Field

    Represents rifles, including assault rifles and sniper rifles.


    hashtag
    HEAVY

    Field

    Represents heavy weapons, such as machine guns and shotguns.

    hashtag
    m_flRealTime

    Field

    Type: float

    Time passed since the game start, in seconds.


    hashtag
    m_iFrameCount

    Field

    Type: int

    Amount of frames rendered since the game start.


    hashtag
    m_flAbsFrameTime

    Field

    Type: float

    Absolute (averaged) frame time. It is calculated over a set of previous frame times, and should not be used for anything that requires accurate frame time like animation.


    hashtag
    m_iMaxClients

    Field

    Type: int

    Maximum amount of clients on the current server.


    hashtag
    m_iTicksThisFrame

    Field

    Type: int

    Amount of ticks passed during the currently rendered frame. Any value above 1 might indicate a stall during rendering.


    hashtag
    m_flRenderFrameTime

    Field

    Type: float

    Time, in which a previous frame was rendered. May be used for animation or by any other means that require accurate frame time.


    hashtag
    m_flCurTime

    Field

    Type: float

    Time passed since the server's game start. This does not indicate the accurate time on the server, although in several events it might be synced by the software.


    hashtag
    m_flTickFraction

    Field

    Type: float

    Current tick's fractional value.


    hashtag
    m_iTickCount

    Field

    Type: int

    Ticks passed since the server's game start.


    hashtag
    m_szMapPath

    Field

    Type: string

    Relative path to current loaded map's file.


    hashtag
    m_szMapName

    Field

    Type: string

    Name of the currently loaded map.

    Guidelines
    Step By Step Guide
    Vec2
    Vec2
    Rect
    CHandle
    Texture
    The library will appear in your dependencies list.
    Select the branch and submit.
    Click Save
    Branches
    Upload a build

    GlowParts

    This enum is used to determine which parts of the glow around the shape should get rendered.

    hashtag
    TL

    Field

    Draw top-left corner.


    hashtag
    TR

    Field

    Draw top-right corner.


    hashtag
    BL

    Field

    Draw bottom-left corner.


    hashtag
    BR

    Field

    Draw bottom-right corner.


    hashtag
    T

    Field

    Draw top line.


    hashtag
    L

    Field

    Draw left line.


    hashtag
    R

    Field

    Draw right line.


    hashtag
    B

    Field

    Draw bottom line.


    hashtag
    ALL_LEFT

    Field

    Draw all the left side shapes. This includes both left corners and the line.


    hashtag
    ALL_RIGHT

    Field

    Draw all the right side shapes. This includes both right corners and the line.


    hashtag
    ALL_TOP

    Field

    Draw all the top side shapes. This includes both top corners and the line.


    hashtag
    ALL_BOTTOM

    Field

    Draw all the bottom side shapes. This includes both bottom corners and the line.


    hashtag
    ALL

    Field

    Draw the entire glow around the shape.


    hashtag
    NO_BOTTOM

    Field

    Draw glow except for the bottom line.


    hashtag
    NO_TOP

    Field

    Draw glow except for the top line.


    hashtag
    NO_RIGHT

    Field

    Draw glow except for the right line.


    hashtag
    NO_LEFT

    Field

    Draw glow except for the left line.

    HitGroup_t

    This enum represents the unique identifier for all player hitgroups. Not to be confused with EHitBox.

    hashtag
    HEAD

    Field


    hashtag
    NECK

    Field


    hashtag
    STOMACH

    Field


    hashtag
    RIGHTARM

    Field


    hashtag
    LEFTARM

    Field


    hashtag
    RIGHTLEG

    Field


    hashtag
    LEFTLEG

    Field


    hashtag
    GENERIC

    Field


    hashtag
    UNUSED

    Field


    hashtag
    INVALID

    Field


    hashtag
    GEAR

    Field


    hashtag
    SPECIAL

    Field

    ObserverMode_t

    This enum represents the observer modes available in the game.


    hashtag
    NONE

    Field

    Represents no observer mode (not spectating anyone).


    hashtag
    FIXED

    Field

    Represents a fixed camera position.


    hashtag
    IN_EYE

    Field

    Represents observing from the perspective of the player being spectated.


    hashtag
    CHASE

    Field

    Represents a chase camera that follows the player being spectated.


    hashtag
    ROAMING

    Field

    Represents a free-roaming camera.


    hashtag
    DIRECTED

    Field

    Represents an automatically directed camera, typically controlled by the game or server.

    MouseButton

    This enum represents mouse buttons.

    hashtag
    LEFT

    Field

    Left mouse button.


    hashtag
    RIGHT

    Field

    Right mouse button.


    hashtag
    MIDDLE

    Field

    Middle (scroll wheel) mouse button


    hashtag
    BACK

    Field

    "Back" mouse button (side button 1).


    hashtag
    FORWARD

    Field

    "Forward" mouse button (side button 2).

    ShadowDir

    This enum is used to determine shadow direction for add_shadow_line method.

    hashtag
    UP

    Field

    The darkest side of the shadow will be at the bottom.


    hashtag
    DOWN

    Field

    The darkest side of the shadow will be at the top.


    hashtag
    LEFT

    Field

    The darkest side of the shadow will be on the left side.


    hashtag
    RIGHT

    Field

    The darkest side of the shadow will be on the right side.

    -- Usually, a 'module' table is created and all of your libraries contents go into it.
    local M = {}
    
    -- You can export functions.
    function M.MyFunction()
        print('Call from my library')
    end
    
    -- Or constants.
    M.MyValue = 979
    
    -- Or any other value.
    M.MenuElement = gui.Checkbox('external_checkbox')
    
    -- At the end of every library, make sure to return the contents you wanna export!
    return M
    -- In another file.
    local my_library = require('library')
    
    my_library.MyFunction() -- Prints 'Call from my library'
    
    print(my_library.MyValue) -- Prints '979'
    
    gui.ctx:Find('lua>elements a'):Add(my_library.MenuElement) -- Adds a new checkbox

    fn

    function

    Callback function. Arguments that are accepted by the function are dictated by the event instance.

    fn

    function

    Callback function, that was earlier passed to the add() function.

    Vector

    View angles.

    ang

    Vector

    View angles.

    vk

    int

    Virtual key.

    int

    Button code.

    local button = game.input_system:VKToButtonCode(0x41); -- 'A'

    code

    int

    Button code.

    string

    Binding.

    local bind = game.gameUIFuncs:GetBindingForButtonCode(code);

    Name

    Type

    Description

    name

    string

    Var name.

    Type

    Description

    ConVar

    Convar object.

    Name

    Type

    Description

    mins

    Vector

    The minimum bounding of the box

    maxs

    Vector

    The maximum bounding of the box

    Name

    Type

    Description

    center

    Vector

    The center of the sphere

    radius

    number

    The radius of the sphere

    index

    number

    The hit position index

    Vector?

    The bullet impact, nil if index >= GetHitPosCount() .

    number

    The bullet impact count

    bomb_beginplant

  • bomb_abortplant

  • bomb_planted

  • bomb_defused

  • bomb_exploded

  • round_start

  • game_newmap

  • map_shutdown

  • Adding those events to the listener is not needed.

    name

    string

    Event name.

    Name

    Type

    Description

    fn

    function(EntityEntry_t)

    Function callback.

    Name

    Type

    Description

    fn

    function(EntityEntry_t)

    Function callback.

    Field

    Type: CGlobalVarsBase

    This service exposes global variables used by the game, such as frame time or current server time.


    hashtag
    engine

    Field

    Type: CEngineClient

    This service exposes the engine client, which includes commonly used engine-related functions.


    hashtag
    input

    Field

    Type: CCSGOInput

    This service exposes the command input system.


    hashtag
    inputSystem

    Field

    Type: CInputSystem

    This service exposes the control input system.


    hashtag
    gameUIFuncs

    Field

    Type: CGameUIFuncs

    This service exposes the game's UI functions.


    hashtag
    physicsQueryInterface

    Field

    Type: CPhysicsQueryInterface

    This service exposes the game's tracing functions.


    hashtag
    gameEntitySystem

    Field

    Type: CGameEntitySystem

    This service exposes some of the game's entity list functions.


    hashtag
    PlaySound

    Method

    Plays a game sound.

    circle-info

    It also accepts sounds in your csgo/sounds directory. Only vsnd_c files are supported.

    Arguments

    Name
    Type
    Description

    sound

    string

    Path to the sound, e.g. sounds/ui/weapon_cant_buy

    volume

    number

    Volume from 0 to 1, if passed -1 it uses the game's volume.

    Returns

    Nothing.

    Example

    hashtag
    __call

    Constructor

    Constructs an SVG texture.

    Arguments

    Name

    Type

    Description

    sv

    string

    SVG text.

    h

    float

    Target height. Defaults to 0, and 0 means that there will be no automatic downscale.

    Returns

    Type

    Description

    SvgTexture

    SVG texture object.

    Example

    Texture
    Field
    Read only

    Type: Ptr

    Pointer to a GPU object. If this object is not created, this field will be nil. You can use the value of this field to pass it to Command directly for example, or if you (for whatever reason we don't recommend you doing) want to have a direct control over the pointer - cast it to FFI's cdata.


    hashtag
    Create

    Method

    Creates a managed object in GPU memory.

    circle-check

    You should Create() an object only once. Invoking this method after the object was created will be meaningless.

    Arguments

    None.

    Returns

    Nothing.

    Example


    hashtag
    Destroy

    Method

    Destroys a managed object in GPU memory.

    triangle-exclamation

    Never destroy a GPU object if it is being used in rendering (for example, when you have pushed some shape that uses a texture, and then destroyed that texture). This will lead to undefined behavior, and most likely, **crash the game **.

    Arguments

    None.

    Returns

    Nothing.

    Example

    drawarrow-up-right
    events.presentQueue:Add(function ()
        -- will be called every time game queues a frame for rendering
    end);
    local function on_present()
        if some_condition then
            events.presentQueue:Remove(on_present)
        end
    end
    
    events.presentQueue:Add(on_present)
    local ang = game.input:GetViewAngles();
    game.input:SetViewAngles(math.Vec3(0, 0, 0));
    local sv_quantize_movement_input = game.cvar:Find('sv_quantize_movement_input')
    if not sv_quantize_movement_input then
        error('sv_quantize_movement_input not found')
    end
    local ray = Ray_t()
    ray:SetHull(Vector(-4, -4, -4), Vector(4, 4, 4)) -- Traces a cube (8x8x8).
    local ray = Ray_t()
    ray:SetSphere(Vector(0, 0, 0), 10) -- Traces a sphere.
    local positions = {}
    for i = 1, pen_result:GetHitPosCount() do
        positions[i] = pen_result:GetHitPos(i - 1)
    end
    local amount = pen_result:GetHitPosCount()
    mods.events:AddListener('round_end');
    entities.players:ForEach(function (entry)
        -- ...
    end);
    entities.players:ForEachZ(function (entry)
        -- ...
    end);
    game.PlaySound('sounds/ui/weapon_cant_buy', 0.1)
    local lightning = draw.SvgTexture([[
    <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
    <path d="M9.55563 13.3232L9.43584 13.3123C7.90803 13.1735 7.14412 13.104 6.90146 12.5814C6.65881 12.0588 7.09869 11.4304 7.97846 10.1736L11.5612 5.05544C12.1424 4.22517 12.433 3.81003 12.6836 3.89831C12.9342 3.98658 12.9005 4.4922 12.8331 5.50343L12.6299 8.55194C12.5685 9.47214 12.5379 9.93224 12.8023 10.2419C13.0667 10.5515 13.5259 10.5933 14.4444 10.6768L14.5642 10.6877C16.092 10.8265 16.8559 10.896 17.0985 11.4186C17.3412 11.9412 16.9013 12.5696 16.0215 13.8264L12.4388 18.9446C11.8576 19.7748 11.567 20.19 11.3164 20.1017C11.0658 20.0134 11.0995 19.5078 11.1669 18.4966L11.3701 15.4481C11.4315 14.5279 11.4621 14.0678 11.1977 13.7581C10.9333 13.4485 10.4741 13.4067 9.55563 13.3232Z" fill="#ffffff"/>
    <path d="M18.5 4L17 6H19L17.5 8" stroke="#ffffff" stroke-opacity="0.6" stroke-linecap="round" stroke-linejoin="round"/>
    <path d="M6.5 16L5 18H7L5.5 20" stroke="#ffffff" stroke-opacity="0.6" stroke-linecap="round" stroke-linejoin="round"/>
    </svg>
    ]], 24);
    tex:Create();
    font:Destroy();

    Let’s start by creating a simple checkbox:

    Each control has a unique ID, which the UI framework uses to distinguish controls within containers. It’s very important that your control’s ID doesn’t conflict with others, as that could result in a broken state or worse.

    To create the ID, call gui.ControlID and pass the desired ID, or just pass a simple string instead.

    Then, create the checkbox by calling gui.Checkbox and passing the ID you've chosen.

    hashtag
    Constructing the row

    By default, controls are typically placed in rows - layouts that stack elements in a specific manner. We provide a simple helper function - gui.MakeControl.

    You may also create both the control and the checkbox, or any other menu element, at the same time using gui.MakeControlEasy !

    hashtag
    Adding the row to a group

    With the control and row ready, let’s add them to a group.

    circle-info

    To view group and control IDs, you can enable Debug mode in the SCRIPTS tab.

    In this example, we'll use the lua>elements a group. First, locate that group in the global context:

    Then call its Add method to include your row:

    That's it!

    circle-info

    It is very important to call Reset() method if you add multiple controls, so the layout will stack everything correctly.

    hashtag
    Using the value

    Next, let’s modify our previous script so the text only appears if the checkbox is checked. Wrap your drawing code in an if statement before rendering the text:

    and close it after.

    The final script should look something like this:

    And here's the result:

    Returns a back buffer texture. May return a blank or outdated texture, if the back buffer texture was not updated.

    Arguments

    None.

    Returns

    Type

    Description

    Back buffer texture pointer.

    Example


    hashtag
    GetBackBufferDownsampled

    Method

    Returns a 4x down sampled version of the back buffer texture.

    Arguments

    None.

    Returns

    Type

    Description

    Downsampled back buffer texture pointer.

    Example


    hashtag
    GetSharedTexture

    Method

    Returns a shared texture. This texture usually replicates the down sampled back buffer texture, although it is updated automatically ONCE before the rendering on the layer starts.

    Arguments

    None.

    Returns

    Type

    Description

    Shared texture pointer.

    Example

    Constructor

    Constructs a font object.

    Arguments

    Name

    Type

    Description

    name

    string

    System font name (example: 'Arial').

    size

    float

    Font height, in pixels.

    fl

    Font flags. Use bit library to construct them. Defaults to 0.

    mi

    int

    Starting codepoint. Defaults to 0.

    Returns

    Type

    Description

    FontGDI

    Font object.

    Example

    FontBase

    Arguments

    Name

    Type

    Description

    name

    string

    Field name.

    Returns

    Type

    Description

    Accessor instance.

    Example

    Arguments

    Name

    Type

    Description

    id

    string

    Control ID.

    Returns

    Type

    Description

    <>?

    Casted control. Returns nil if the control was not found, or casting failed.

    Example


    hashtag
    user

    Field

    Type: User_t

    User's basic information.

    Method

    Returns the absolute origin (the one that is used for rendering).

    Arguments

    None.

    Returns

    Type

    Description

    Origin.

    Example


    hashtag
    GetGrenadeType

    Method

    Returns the grenade type.

    Arguments

    None.

    Returns

    Type

    Description

    int

    Grenade type.

    Example

    C_BaseEntity

    Step By Step Guide

    In this tutorial you’ll create and publish a script to the Storefront. The same flow applies to Libraries and Configs.

    hashtag
    Create the item

    Go to Workshop -> Manage Items and click Create new item.

    Fill out:

    • Title

    • Game (the supported title your script targets)

    • Item type (Script / Library / Config)

    triangle-exclamation

    Warning: You cannot change the item type later.

    hashtag
    Upload a build

    Open the Builds tab and click Upload new build.

    Fill out:

    • Version (use semantic versioning like 1.0.0 if possible)

    • Changelog (short, factual)

    • File upload (your .lua file or a .zip

    circle-info

    Note: You can upload a ZIP to bundle assets alongside the script. See

    Click Save. The build is created in the Draft state.

    Click Submit for review. The build state changes to Under review.

    After moderation approves it, you’ll get a notification and the state changes to Approved.

    Click Set to branch and choose Default.

    This makes the approved build the version users receive when they add your script to their library.

    circle-info

    Tip: Use a Beta branch to test new builds with a subset of users before moving them to Default. See

    hashtag
    Configure capabilities

    If your script needs restricted APIs (e.g. FFI, filesystem, clipboard), enable the required Capabilities so users can grant permission.

    In Builds -> Capabilities (right side), select only what you need and click Save.

    circle-info

    Best practice: Request the minimum capabilities your script actually uses. Users will see and approve these.

    hashtag
    Prepare the Storefront listing

    Open the General tab and complete all fields in the Release Checklist.

    When the checklist is complete, click Submit for review on the item. After moderation approves it, the item is automatically published on the Storefront and users can purchase or subscribe.

    Global Functions

    Below is a list of all global functions. By “global”, we mean these functions do not require a preceding namespace - so you can call them directly, unlike other functions.

    hashtag
    print

    Function

    Prints text to game's console. Automatically inserts a space between parameters.

    hashtag
    Arguments

    Name
    Type
    Description

    Example


    hashtag
    error

    Function

    Prints an error text to game's console, and shuts down the script. Try to avoid using this function - use it only if an error happens which you can't recover from.

    hashtag
    Arguments

    Name
    Type
    Description

    Example


    hashtag
    unpack

    Function

    Unpacks a table of elements.

    hashtag
    Arguments

    Name
    Type
    Description

    Example


    hashtag
    Delay

    Function

    Delays a callback by a certain amount of time, in seconds.

    hashtag
    Arguments

    Name
    Type
    Description

    Example


    hashtag
    __shutdown

    Function

    Special function, it's called whenever the script unloads. Isn't called in case of errors.

    hashtag
    Arguments

    None.

    Example

    CNetChan

    Provides a way to interface with a Network Channel's class.

    hashtag
    GetAddress

    Method

    triangle-exclamation

    If the current channel is null, this function will return nil instead.

    Returns address string of the remote machine.

    Arguments

    None.

    Returns

    Example


    hashtag
    IsLoopback

    Method

    triangle-exclamation

    If the current channel is null, this function will return nil instead.

    Returns whether the current channel is connected to the local machine (loopback address).

    Arguments

    None.

    Returns

    Example


    hashtag
    IsNull

    Method

    Returns whether the channel is stubbed.

    Arguments

    None.

    Returns

    Example


    hashtag
    GetLatency

    Method

    triangle-exclamation

    If the current channel is null, this function will return nil instead.

    Returns current latency to the remote server (in seconds).

    Arguments

    None.

    Returns

    Example

    CGameTrace

    Encapsulates all tracing information returned by the tracing methods.

    hashtag
    m_pEnt

    FieldRead only

    Type:


    hashtag
    m_EntHandle

    FieldRead only

    Type:


    hashtag
    m_vStartPos

    FieldRead only

    Type:


    hashtag
    m_vEndPos

    FieldRead only

    Type:


    hashtag
    m_Plane

    FieldRead only

    Type:


    hashtag
    m_flFraction

    FieldRead only

    Type: number


    hashtag
    m_iPhysBone

    FieldRead only

    Type: number


    hashtag
    m_nEntBone

    FieldRead only

    Type: number


    hashtag
    m_bStartSolid

    FieldRead only

    Type: boolean


    hashtag
    DidHit

    Method

    Returns whether or not the trace hit an entity or the world.

    Arguments

    Nothing.

    Returns


    hashtag
    DidHitWorld

    Method

    Returns whether or not the trace hit the world.

    Arguments

    Nothing.

    Returns

    CGameEntitySystem

    Usage:

    Usage: game.gameEntitySystem:{method}

    This type encapsulates some entity querying functionalities. If you wish to loop for players, controllers, dropped items or projectiles, go here.

    hashtag
    ForEachByClass

    Function

    Loops for all entities with a given class.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    GetFirstByClass

    Function

    Finds and returns the first entity from a specific class.

    Arguments

    Returns

    Example


    Accessor

    hashtag
    accessor

    Last modified: 03 January 2025

    This type represents a safe way to access maps.

    circle-info

    Note that <type> indicates the specific type this instance holds. Accessor<> for example means that Get will return an instance of , and Set will only accept the type as it's obj parameter.

    hashtag
    __index

    Function

    Returns an object by key.

    Arguments

    Returns

    Example


    hashtag
    __newindex

    Function

    Sets an object by key.

    Arguments

    Returns

    Nothing.

    Example

    SchemaAccessor_t

    This type represents a special structure that references a certain field in the entity object.

    circle-info

    You can check the returned type by using type() function.

    triangle-exclamation

    Do not ever store an instance of this type anywhere but in a scope of an event because entity might be removed.

    hashtag
    offset

    Field

    Type: number


    hashtag
    Get

    Method

    Returns the value.

    Arguments

    None.

    Returns

    Example


    hashtag
    GetAs

    Method

    Returns the value casted as another game class. Automatically dereferences pointers.

    Arguments

    Returns

    Example


    hashtag
    Set

    Method

    Sets the value.

    Arguments

    Returns

    Nothing.

    Example

    ControlID

    This type represents a control ID.

    circle-info

    This type is mostly deprecated and can be replaced by strings on all control constructors.

    hashtag
    __call

    Constructor

    Constructs the ID structure.

    Arguments

    Returns

    Example


    hashtag
    id

    FieldRead only

    Type: int

    Hashed representation of the ID.


    hashtag
    idString

    FieldRead only

    Type: string

    Normal representation of the ID.

    NotificationSystem

    This type represents a notification system.

    hashtag
    Add

    Method

    Adds a notification to the list.

    Arguments

    Returns

    Nothing.

    Example

    Notification

    This type represents a notification item.

    hashtag
    __call

    Constructor

    Constructs the notification.

    Arguments

    Returns

    Example

    User_t

    This type represents basic user information.

    hashtag
    avatar

    FieldRead only

    Type: ?

    User's avatar. May be nil.


    hashtag
    username

    FieldRead only

    Type: string

    User's username.

    First Steps

    Now that you’ve covered the essentials, it’s time to start scripting.

    hashtag
    Fire up a text editor

    Feel free to use any text editor you prefer: , , or even a simple Notepad.

    Local scripts are located here: <CS2_Directory>/game/csgo/fatality/scripts. You may notice there's also a lib

    CEngineClient

    Usage: game.engine:{method}

    An instance of this type provides a way to interface with Source 2's Engine-to-Client service.

    hashtag
    GetLastTimestamp

    penetration

    Usage: mods.penetration.{method}
    circle-exclamation

    Methods in this namespace are accessed with the . operator, not the usual : operator.

    CHandle

    This type represents an entity handle.

    circle-info

    You can also compare this type using a == operator.

    hashtag

    C_CSWeaponBase

    This type represents a CCSWeaponBase entity.

    circle-info

    This type inherits type. All of its base methods and fields are also available in this type.

    hashtag

    EHitBox

    This enum represents the unique identifier for all player hitboxes.

    hashtag
    HEAD

    Field


    local cb = gui.Checkbox('my_checkbox');
    local row = gui.MakeControl('My checkbox', cb);
    local cb, row = gui.MakeControlEasy('my_checkbox', 'My checkbox', 'checkbox')
    local group = gui.ctx:Find('lua>elements a');
    group:Add(row);
    if cb:GetValue():Get() then
    local cb, row = gui.MakeControlEasy('my_checkbox', 'Checkbox', 'checkbox');
    local group = gui.ctx:Find('lua>elements a');
    group:Add(row);
    
    local function onPresentQueue()
        if cb:GetValue():Get() then
            local d = draw.surface;
            d.font = draw.fonts['gui_main'];
            d:AddText(draw.Vec2(50, 50),
                'Hello drawing! My first script speaking.',
                draw.color.White()
            );
        end
    end
    
    events.presentQueue:Add(onPresentQueue);
    local bb = adapter:GetBackBuffer();
    local ds = adapter:GetBackBufferDownsampled();
    local shared = adapter:GetSharedTexture();
    local sys_font = draw.FontGDI('Calibri', 14);
    local price = wpn_data.m_nPrice;
    local price = wpn_data['m_nPrice']; -- this also works
    local some_cb = gui.ctx:Find('some_cb');
    local org = wep:GetAbsOrigin();
    local type = gren:GetGrenadeType();
    local cb = gui.Checkbox('my_checkbox_id') -- Auto converts into ControlID
    hashtag
    NECK

    Field


    hashtag
    UPPER_CHEST

    Field


    hashtag
    CHEST

    Field


    hashtag
    THORAX

    Field


    hashtag
    PELVIS

    Field


    hashtag
    RIGHT_UPPER_ARM

    Field


    hashtag
    LEFT_UPPER_ARM

    Field


    hashtag
    RIGHT_LOWER_ARM

    Field


    hashtag
    LEFT_LOWER_ARM

    Field


    hashtag
    RIGHT_HAND

    Field


    hashtag
    LEFT_HAND

    Field


    hashtag
    RIGHT_UPPER_LEG

    Field


    hashtag
    LEFT_UPPER_LEG

    Field


    hashtag
    RIGHT_LOWER_LEG

    Field


    hashtag
    LEFT_LOWER_LEG

    Field


    hashtag
    RIGHT_FOOT

    Field


    hashtag
    LEFT_FOOT

    Field


    Type

    Description

    boolean

    Whether it hit something or not

    Type

    Description

    boolean

    Whether it hit the world or not

    C_BaseEntity
    CHandle
    Vector
    Vector
    CPlane
    Texture
    Ptr
    Ptr
    Ptr

    ma

    int

    Ending codepoint. Defaults to 255 (entire ASCII code page).

    weight

    int

    Font weight. Defaults to 400 (regular).

    FontFlags
    SchemaAccessor_t
    Control
    Vector
    )
    Bundled Assets
    Branches

    CSWeaponType

    This enum represents the weapon type in the game.

    hashtag
    KNIFE

    Field

    Represents a knife-type weapon.


    hashtag
    PISTOL

    Field

    Represents a pistol-type weapon.


    hashtag
    SUBMACHINEGUN

    Field

    Represents a submachine gun-type weapon.


    hashtag
    RIFLE

    Field

    Represents a rifle-type weapon.


    hashtag
    SHOTGUN

    Field

    Represents a shotgun-type weapon.


    hashtag
    SNIPER_RIFLE

    Field

    Represents a sniper rifle-type weapon.


    hashtag
    MACHINEGUN

    Field

    Represents a machine gun-type weapon.


    hashtag
    C4

    Field

    Represents a C4 explosive.


    hashtag
    TASER

    Field

    Represents a taser weapon.


    hashtag
    GRENADE

    Field

    Represents a grenade-type weapon.


    hashtag
    STACKABLEITEM

    Field

    Represents a stackable item-type weapon.


    hashtag
    FISTS

    Field

    Represents fists as a weapon type.


    hashtag
    BREACHCHARGE

    Field

    Represents a breach charge-type weapon.


    hashtag
    BUMPMINE

    Field

    Represents a bump mine-type weapon.


    hashtag
    TABLET

    Field

    Represents a tablet-type weapon.


    hashtag
    MELEE

    Field

    Represents a melee-type weapon.


    hashtag
    SHIELD

    Field

    Represents a shield-type weapon.


    hashtag
    ZONE_REPULSOR

    Field

    Represents a zone repulsor-type weapon.


    hashtag
    UNKNOWN

    Field

    Represents an unknown weapon type.

    ...

    ...

    Values to print in the console.

    text

    string

    Read print for documentation.

    tbl

    table

    Any table

    delay

    number

    Delay, in seconds

    callback

    function

    Callback

    Type

    Description

    string?

    IP-address or Steam Server Address.

    Type

    Description

    bool?

    true if connected to the local machine.

    Type

    Description

    bool

    true if current channel is a dummy channel.

    Type

    Description

    float?

    Latency (in seconds).

    Name

    Type

    Description

    className

    string

    The entity class name

    callback

    function<C_BaseEntity>

    The loop callback

    Name

    Type

    Description

    className

    string

    The entity class name

    Type

    Description

    C_BaseEntity | nil

    The entity, nil if not found.

    Name

    Type

    Description

    key

    string

    Object key.

    Type

    Description

    <type>

    Object.

    Name

    Type

    Description

    key

    string

    Object key.

    obj

    <type>

    Object.

    Texture
    Texture
    Texture

    Type

    Description

    <type>

    Value.

    Name

    Type

    Description

    module

    string

    The name of the module

    class

    string

    The name of the class

    Type

    Description

    <type>

    Casted value.

    Name

    Type

    Description

    value

    <type>

    Value.

    Name

    Type

    Description

    id

    string

    ID.

    Type

    Description

    ControlID

    ID structure.

    Name

    Type

    Description

    notif

    Notification

    Notification object.

    notif:Add(my_notification);

    Name

    Type

    Description

    hdr

    string

    Header (title).

    txt

    string

    Text (body).

    ico

    Texture?

    Icon. Defaults to nil.

    Type

    Description

    Notification

    Notification object.

    index

    Field

    Type: number


    hashtag
    Get

    Method

    Returns the entity, or nil if nothing found.

    Arguments

    None.

    Returns

    Type

    Description

    <type>

    Entity instance.

    Example


    hashtag
    Valid

    Method

    Returns true if the handle is valid.

    Arguments

    None.

    Returns

    Type

    Description

    bool

    true if valid.

    Example


    hashtag
    IsClientSide

    Method

    Returns true if the handle links to a client-side entity.

    Arguments

    None.

    Returns

    Type

    Description

    bool

    true if client-sided.

    Example

    print('Hello world!', 123); -- prints out "Hello world! 123" to the console
    error('Can't recover from this one! Error: ' .. tostring(123));
    local message = { 'Hello', 'World' }
    print(unpack(message)) -- 'Hello world'
    Delay(0.5, function()
        print('Print after 0.5 seconds')
    end)
    function __shutdown()
        print('Script was unloaded successfully.')
    end
    local chan = game.engine:GetNetChan();
    if chan and not chan:IsNull() then
        print(chan:GetAddress());
    end
    local chan = game.engine:GetNetChan();
    if chan and not chan:IsNull() and chan:IsLoopback() then
        print('Connected to localhost!');
    end
    local chan = game.engine:GetNetChan();
    if not chan or chan:IsNull() then
        print('Not connected!');
    end
    local chan = game.engine:GetNetChan();
    if chan and not chan:IsNull() then
        print('Current latency: ' .. tostring(math.round(chan:GetLatency() * 1000.0)) .. 'ms');
    end
    game.gameEntitySystem:ForEachByClass('C_C4', function(entity)
        if entity.m_bStartedArming:Get() then
            print('Someone is planting!')
        end
    end)
    local proxy = game.gameEntitySystem:GetFirstByClass('C_CSGameRulesProxy')
    local game_rules = proxy.m_pGameRules:GetAs('client.dll', 'C_CSGameRules')
    
    if not game_rules then
    	error('Not found')
    end
    
    print(game_rules.m_bWarmupPeriod:Get())
    local main_font = draw.fonts['gui_main'];
    
    -- this also works
    local main_font_2 = draw.fonts.gui_main;
    draw.fonts['my_font'] = my_font;
    
    -- this also works
    draw.fonts.my_font = my_font;
    local health = player.m_iHealth:Get();
    local collision = player.m_pCollision:GetAs('client.dll', 'CCollisionProperty');
    local mins = collision.m_vecMins:Get()
    local maxs = collision.m_vecMaxs:Get()
    player.m_iHealth:Set(50); -- won't really do anything with the health
    local id = gui.ControlID('my_id');
    local notif = gui.Notification('Hello', 'Lua works!');
    local ent = handle:Get();
    if handle:Valid() then
        -- ...
    end
    if handle:IsClientSide() then
        -- ...
    end
    directory, but we’ll get to that later.

    Create a new file ending with .lua, and begin your work on the script.

    circle-info

    .ljbc format cannot be loaded from local sources.

    hashtag
    Writing your first script

    A typical “Hello world!” example can be a bit trivial, so let’s try something slightly more advanced instead.

    Now, let's break down this example script:

    hashtag
    Defining a callback function

    Most of your scripting will run within several callbacks we provide. Each event has its own signature, so pay attention to the parameters your callback function should accept. presentQueue doesn’t provide any parameters, so our function doesn’t need any either.

    circle-info

    Defining something local is optional, although recommended for clearer scope management.

    hashtag
    Accessing drawing layer

    With the callback function defined, let’s actually render something on the screen!

    To do this, you first need to access the drawing layer. We provide a single drawing layer that’s safe to use within the game thread. Due to how the game functions internally, it’s strongly discouraged to call game functions in other threads. Luckily all of our events run in the game thread.

    This setup allows you not only to draw but also to query information on player health or other entities.

    To access the layer, simply reference the surface field in the draw table:

    circle-info

    You don't have to store it in a variable, but it would be nicer if you don't have to type out draw.surface every time, right?

    hashtag
    Setting a font

    After retrieving the layer, you must set a font object before drawing any text on the screen. This is purely for performance reasons, so you don’t have to pass a heavy font object every time you draw text.

    All fonts are stored in draw.fonts. To access a font, either use dot syntax, or treat it like a dictionary:

    hashtag
    Drawing text

    With the font set, it’s time to draw some text.

    Invoke the AddText method on the layer. Notice that it’s called using the colon syntax: obj:fn(), because it’s a method.

    circle-info

    You can also invoke methods with a dot syntax, as long as you provide the object in the first argument. Both calls: obj:fn() and obj.fn(obj) are identical.

    hashtag
    Registering a callback

    Now that you’ve created your first callback, you need to register it so Fatality knows to invoke it. This is done by calling the Add method on events.presentQueue.

    hashtag
    Result

    That's it! If you've done everything correctly, you should see something like this:

    My first lua
    Visual Studio Codearrow-up-right
    Notepad++arrow-up-right
    Method

    Returns last timestamp, in seconds.

    Arguments

    None.

    Returns

    Type
    Description

    float

    Timestamp, in seconds.

    Example


    hashtag
    GetLastServerTick

    Method

    Returns last server tick number.

    Arguments

    None.

    Returns

    Type
    Description

    int

    Server tick number.

    Example


    hashtag
    InGame

    Method

    Returns whether the client is currently in game.

    Arguments

    None.

    Returns

    Type
    Description

    bool

    In-game status.

    Example


    hashtag
    IsConnected

    Method

    Returns whether the client is currently connected to a game server.

    Arguments

    None.

    Returns

    Type
    Description

    bool

    true if connected.

    Example


    hashtag
    GetNetChan

    Method

    Returns the Network Channel used for network communication.

    Arguments

    None.

    Returns

    Type
    Description

    Network channel, or nil if does not exist.

    Example


    hashtag
    ClientCmd

    Method

    Executes a client-sided console command.

    Arguments

    Name
    Type
    Description

    cmd

    string

    Command to execute.

    bool

    unrestricted

    Whether should the execution preserve any restrictions. Defaults to false.

    Returns

    Nothing.

    Example


    hashtag
    GetScreenSize

    Method

    Returns client window screen size.

    Arguments

    None.

    Returns

    Type
    Description

    int

    Width.

    int

    Height.

    Example

    Only call these inside the createMove callback!

    hashtag
    FireBullet

    Function

    Simulates a bullet fired from a specific weapon.

    circle-info

    This function can be expensive, use it moderately.

    Arguments

    Name
    Type
    Description

    origin

    Where the bullet is coming from

    delta

    The direction the bullet is going, computed as end_point - origin_point

    weapon

    The gun the bullet is being fired from

    target

    The target player, can be nil

    Returns

    Type
    Description

    boolean

    If there was an error during simulation.

    The penetration data

    Example


    hashtag
    ScaleDamage

    Function

    Scales up the damage from a weapon given a hitgroup and, optionally, a player.

    Arguments

    Name
    Type
    Description

    damage

    number

    The damage to be scaled

    weapon

    The gun the bullet is being fired from

    hitgroup

    The desired hitgroup.

    target

    The target player

    Returns

    Type
    Description

    number

    The scaled damage

    Example

    GetAbsOrigin

    Method

    Returns the absolute origin (the one that is used for rendering).

    Arguments

    None.

    Returns

    Type

    Description

    Origin.

    Example

    hashtag
    GetDefIndex

    Method

    Returns the weapon definition index.

    Arguments

    None.

    Returns

    Type

    Description

    Weapon ID.

    Example

    hashtag
    GetType

    Method

    Returns the weapon type.

    Arguments

    None.

    Returns

    Type

    Description

    Weapon type.

    Example

    hashtag
    GetData

    Method

    Returns the weapon static data.

    Arguments

    None.

    Returns

    Type

    Description

    Weapon data.

    Example

    C_BaseEntity

    AnimatedTexture

    This type is an animated texture. This texture type only supports animated GIF types, and does not support APNG.

    circle-info

    This type inherits Texture type. All of its base methods and fields are also available in this type.

    circle-check

    If you pass an unsupported type, it will instead work exactly like type, meaning controlling frames and looping will be meaningless.

    circle-check

    Using this type for texture atlases is possible, although highly unrecommended. It will produce extra texture objects in memory, and overall will be much slower. Instead, it is advised to construct an actual texture atlas, use type, and use texture mapping.

    hashtag
    __call

    Constructor

    Constructs animated texture.

    triangle-exclamation

    Passing an invalid pointer, a or memory region that is smaller than the size will result in a crash.

    Arguments

    1. From file.

    2. From memory.

    Returns

    Example


    hashtag
    shouldLoop

    Field

    Type: bool

    If set to false, will not loop the animation automatically. Defaults to true.


    hashtag
    ResetLoop

    Method

    Reset loop to run from the first frame.

    Arguments

    None.

    Returns

    Nothing.

    Example


    hashtag
    SetFrame

    Method

    Set a specific frame on the animation. If looping is enabled, will continue the cycle from the passed frame. Otherwise, will display a specific frame of the animation.

    circle-info

    Frame count starts from 0.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    GetFrameCount

    Method

    Returns amount of frames in the animation.

    Arguments

    None.

    Returns

    Example

    Font

    This type represents a font object. Internally, this type uses FreeType library to rasterize font glyphs.

    circle-info

    This type inherits FontBase type. All of its base methods and fields are also available in this type.

    hashtag
    __call

    Constructor

    Constructs a font object.

    triangle-exclamation

    Passing an invalid pointer, a or memory region that is smaller than the size will result in a crash.

    Arguments

    1. From file.

    1. From memory.

    1. From memory, with codepoint pairs.

    Returns

    Example

    entities

    This table represents an internal entity list.

    triangle-exclamation

    Never store any entities in the global scope! Any entity might get deleted, and you will no longer have a valid instance of that entity, which will inevitably lead to a crash. If you need to globally store an entity somewhere, we strongly recommend you store an instance of CHandle, and use it's Get method to retrieve the entity again, when needed.

    hashtag
    players

    Field

    Type: <>

    Player pawns.


    hashtag
    controllers

    Field

    Type: <>

    Player controllers.


    hashtag
    items

    Field

    Type: <>

    Items (held).


    hashtag
    droppedItems

    Field

    Type: <>

    Dropped items.


    hashtag
    projectiles

    Field

    Type: <>

    Grenade projectiles.


    hashtag
    GetLocalPawn

    Function

    Returns the local player's pawn.

    Arguments

    None.

    Returns

    Example


    hashtag
    GetLocalController

    Function

    Returns the local player's controller.

    Arguments

    None.

    Returns

    Example

    local function onPresentQueue()
        local d = draw.surface;
        d.font = draw.fonts['gui_main'];
        d:AddText(draw.Vec2(50, 50),
            'Hello drawing! My first script speaking.',
             draw.Color.White()
        );
    end
    
    events.presentQueue:Add(onPresentQueue);
    local function onPresentQueue()
    end
    local d = draw.surface;
    d.font = draw.fonts['gui_main'];
    d:AddText(draw.Vec2(50, 50),
      'Hello drawing! My first script speaking brev.',
      draw.Color.White()
    );
    events.presentQueue:add(onPresentQueue);
    local last_time = game.engine:GetLastTimestamp();
    local server_tick = game.engine:GetLastServerTick();
    if game.engine:InGame() then
        print("I'm in game!");
    end
    if game.engine:IsConnected() then
        print("I'm connected!");
    end
    local chan = game.engine:GetNetChan();
    game.engine:ClientCmd('say Hello!');
    local w, h = game.engine:GetScreenSize();
    local eye_position = local_player:GetEyePos()
    local weapon = local_player:GetActiveWeapon()
    local enemy_position = enemy:GetHitboxCenter(EHitBox.HEAD)
    
    local _, pen = mods.penetration.FireBullet(eye_position, enemy_position - eye_position, 
                                             weapon, enemy)
    
    print(pen.damage, pen.hitgroup)
    local weapon = local_player:GetActiveWeapon()
    
    local dmg = mods.penetration.ScaleDamage(45, weapon, HitGroup_t.HEAD, enemy)
    local org = wep:GetAbsOrigin();
    local wep_id = wep:GetDefIndex();
    local type = wep:GetType();
    local data = wep:GetData();
    CNetChan

    clamp

    boolean

    Whether or not to clamp the tracing to the player.

    Vector
    Vector
    C_CSWeaponBaseGun
    C_CSPlayerPawn
    PenResult_t
    C_CSWeaponBaseGun
    HitGroup_t
    C_CSPlayerPawn
    Vector
    EItemDefinitionIndex
    CSWeaponType
    CCSWeaponBaseVData

    Name

    Type

    Description

    path

    string

    Path to the texture file.

    Name

    Type

    Description

    data

    Ptr

    Pointer to texture file data in memory.

    sz

    int

    Size of the texture file data.

    Type

    Description

    animated_texture

    Animated texture instance.

    Name

    Type

    Description

    frame

    int

    Frame number. Invalid frame numbers will be clamped.

    Type

    Description

    int

    Frame count.

    Texture
    Texture

    int

    Ending codepoint. Defaults to 255 (entire ASCII code page).

    int

    Starting codepoint. Defaults to 0.

    ma

    int

    Ending codepoint. Defaults to 255 (entire ASCII code page).

    table[{int, int}...]

    Min/max pairs. This is a standard array, consisting of {int, int} pairs.

    Name

    Type

    Description

    path

    string

    Path to a ttf/otf file.

    size

    float

    Font height, in pixels.

    fl

    FontFlags

    Font flags. Use bit library to construct them. Defaults to 0.

    mi

    int

    Starting codepoint. Defaults to 0.

    Name

    Type

    Description

    mem

    Ptr

    Pointer to a font file in memory.

    sz

    int

    Font file size, in bytes.

    size

    float

    Font height, in pixels.

    fl

    FontFlags

    Font flags. Use bit library to construct them. Defaults to 0.

    Name

    Type

    Description

    mem

    Ptr

    Pointer to a font file in memory.

    sz

    int

    Font file size, in bytes.

    size

    float

    Font height, in pixels.

    fl

    FontFlags

    Font flags. Use bit library to construct them. Defaults to 0.

    Type

    Description

    Font

    Font object.

    ma

    mi

    pairs

    Type

    Description

    C_CSPlayerPawn

    Pawn.

    Type

    Description

    C_CSPlayerController

    Controller.

    EntityList_t
    C_CSPlayerPawn
    EntityList_t
    C_CSPlayerController
    EntityList_
    C_CSWeaponBase
    EntityList_
    C_CSWeaponBase
    EntityList_
    C_BaseCSGrenadeProjectile
    local gif = draw.AnimatedTexture('funny_gif.gif');
    gif:ResetLoop();
    gif:SetFrame(5);
    local frames = gif:GetFrameCount();
    gif:SetFrame(frames - 2); -- set to the last frame
    local cool_font = draw.Font('myfont.ttf', 16);
    local lp = entities.GetLocalPawn();
    local lp_ctrl = entities.GetLocalController();

    events

    Usage: events.{event_name}

    There are a number of events that Fatality provides to use in the API - from various hooks, to in-game events. Each event entry is an object of Event_t. This table documents events to be used by your scripts.

    circle-info

    You are not required to remove events when your script unloads. It is done automatically by the API engine.

    circle-info

    There is an equivalent to an unload or shutdown callback, check it out .

    hashtag
    presentQueue

    Field

    Invoked each time the game queues a frame for rendering. This is the only permitted location for drawing on screen.

    Arguments

    None.


    hashtag
    frameStageNotify

    Field

    Invoked every time the game progresses onto another frame stage. This event is called before the game handles a new frame stage.

    Arguments

    Name
    Type
    Description

    hashtag
    renderStartPre

    Field

    Invoked every time game starts the scene rendering process. This event is called before the game's function runs.

    Arguments

    None.


    hashtag
    renderStartPost

    Field

    Invoked every time game starts scene rendering process. This event is called after the game's function runs.

    Arguments

    Name
    Type
    Description

    hashtag
    setupViewPre

    Field

    Invoked every time the game sets up the view information. This event is called after the game's function runs.

    circle-info

    You can retrieve the view information from game.viewRender service.

    Arguments

    None.


    hashtag
    overrideView

    Field

    Invoked every time the game internally overrides view information. You are free to change whatever you like in the provided view setup.

    Arguments


    hashtag
    createMove

    Field

    Invoked every time the game processes a game tick.

    Arguments


    hashtag
    event

    Field

    Invoked every time a game event fires.

    circle-info

    We do not listen to every single event that exists in the game. If you need something that we don't listen to, please use

    Arguments

    Name
    Type
    Description

    hashtag
    input

    Field

    Invoked every time the GUI processes input.

    Arguments

    Name
    Type
    Description

    hashtag
    menuToggled

    Field

    Invoked every time the GUI window is opened or closed.

    Arguments

    Name
    Type
    Description

    hashtag
    playerInfoPre

    Field

    Invoked every time before the player ESP is rendered. Useful for accessing the rendering layer for visuals or adding new elements to ESP.

    circle-info

    This doesn't override the software's configuration, meaning that if you have ESP disabled for either enemies or teammates, the callback will not be called for those players.

    Arguments

    Name
    Type
    Description

    hashtag
    playerInfoPost

    Field

    Invoked every time after the player ESP is rendered.

    circle-info

    This doesn't override the software's configuration, meaning that if you have ESP disabled for either enemies or teammates, the callback will not be called for those players.

    Arguments

    Name
    Type
    Description

    CPhysicsQueryInterface

    Usage:

    Usage: game.physicsQueryInterface:{method}

    This type encapsulates all tracing functionalities.

    hashtag
    TraceRay

    Function

    Performs a regular trace ray call. Skips local player.

    Arguments

    Returns

    Example


    hashtag
    TraceMovement

    Function

    Performs a trace ray call using the player movement mask. Skips local player.

    Arguments

    Returns

    Example


    hashtag
    TraceGrenade

    Function

    Performs a trace call using the grenade mask, as a line. Doesn't use a custom ray.

    Arguments

    Returns


    hashtag
    TraceGrenadeHull

    Function

    Performs a trace call using the grenade mask, as a hull. Doesn't use a custom ray.

    Arguments

    Returns

    Command

    This type is used to change render command parameters.

    triangle-exclamation

    Be cautious when changing stuff in an instance of this type. Passing invalid data to texture or frag_shader, or not restoring some changes after you're done drawing can lead to undefined behavior, and more likely, a crash. If you are not sure how to operate this type, take a look into examples.

    hashtag
    texture

    Field

    Type:

    Texture pointer. You can get one from an instance of type by accessing obj field. Passing invalid data to this field WILL result in a crash. For a safer way, please use .


    hashtag
    fragShader

    Field

    Type:

    Fragment shader (aka Pixel Shader in DirectX terms) pointer. You can get one from an instance of type by accessing obj field. Passing invalid data to this field WILL result in a crash. For a safer way, please use .


    hashtag
    clipRect

    Field

    Type: ?

    Clip rectangle used for scissor testing. If this is set to nil, will not clip anything.

    circle-check

    It is advised to instead use layer's override_clip_rect method. While you can pass custom rect to this field, you will lose information about previous clip rects set before. Using that method will make sure to intersect the previous rect with the one you pass and produce a probably more expected result.


    hashtag
    uvRect

    Field

    Type: ?

    UV rect used for texture mapping. If this field is set to nil, will use 0, 0, 1, 1 rectangle to map the texture. You can learn more about texture mapping in the tutorial section.


    hashtag
    alpha

    Field

    Type: float

    Global opacity override. Defaults to 1, but if you set anything else - will modulate opacity of every next shape you will render.


    hashtag
    rotation

    Field

    Type: float

    Shape rotation. Not all shapes support this field. The value is set in degrees, not radians.


    hashtag
    antiAlias

    Field

    Type: bool

    If set to true, will apply tesselation to shapes.

    circle-info

    As of now, not every shape supports tesselation, but it is advised to have it enabled at all times anyway. It will produce much better result anyway.


    hashtag
    ignoreScaling

    Field

    Type: bool

    If set to true, will ignore global DPI scale. This is set to true by default, but you are free to change it to false if you are trying to render some custom UI elements.


    hashtag
    chainedCall

    Field

    Type: bool

    Only useful when using shaders. If set to true, will not update back buffer texture. This can be used if you need the very same texture data, as when applying several shaders to the back buffer.

    circle-info

    Please note that capturing back buffer is a rather slow operation. It is better to not capture it too often. Back buffer is automatically captured to the only layer you can use anyway, and it is better to use that one instead, to make sure rendering happens as fast as it is possible.


    hashtag
    onlyDownsampled

    Field

    Type: bool

    If set to true, will capture back buffer (as long as chainedCall is set to false). The name of this field is quite misleading due to the fact that in the CS:GO version of Fatality, it was used to configure if the rendering system should also downsample the captured backbuffer into another texture. In DirectX11, this operation is much faster, so it is done regardless.


    hashtag
    captureBackBuffer

    Field

    Type: bool

    An alias to onlyDownsampled.


    hashtag
    isTile

    Field

    Type: bool

    If set to true, will use a separate texture sampler that supports tiling. By default, all textures are stretched, but if you enable this option - their tiling and stretch will be fully configurable by the uv_rect field.


    hashtag
    mode

    Field

    Type:

    Rendering mode. You can read more about it in the type's documentation.


    hashtag
    SetTexture

    Method

    Sets a texture in a safe manner.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    SetShader

    Method

    Sets a fragment shader in a safe manner.

    Arguments

    Returns

    Nothing.

    Example

    Shader

    This type represents a shader. HLSL documentationarrow-up-right

    circle-info

    This type inherits Managed type. All of its base methods and fields are also available in this type.

    circle-info

    Only fragment shaders (aka Pixel Shaders) are supported.

    circle-check

    Rendering system uses Shader Version 4 (ps_4_0).

    hashtag
    HLSL structures

    The constant buffer fields are the following:

    The input fields are the following:

    The bound objects are the following:

    Template:


    hashtag
    __call

    Constructor

    Constructs a shader.

    Arguments

    Returns

    Example

    C_BaseEntity

    This type represents a base game entity.

    circle-info

    hashtag

    This type may be returned for any other abstract entity class, but internally will point to the correct type.

    hashtag
    __index

    Function

    Attemps to search for a field in this class.

    Arguments

    Returns

    Example


    hashtag
    GetClassName

    Function

    Returns schema class name.

    Returns

    Example


    hashtag
    GetHandle

    Function

    Returns handle for this entity.

    Returns

    Example


    hashtag
    GetPointer

    Function

    Returns a memory address for this entity, useful with FFI.

    Returns

    Example


    hashtag
    ToWeaponBaseGun

    Function

    Safe-casts the entity to , returns nil if not a .

    Returns

    Example


    hashtag
    ToWeaponBase

    Function

    Safe-casts the entity to , returns nil if not a .

    Returns

    Example


    hashtag
    ToPlayerPawn

    Function

    Safe-casts the entity to , returns nil if not a .

    Returns

    Example


    hashtag
    ToPlayerController

    Function

    Safe-casts the entity to , returns nil if not a .

    Returns

    Example

    Texture

    This type represents a texture object.

    circle-info

    This type inherits Managed type. All of its base methods and fields are also available in this type.

    circle-info

    Supported texture formats are:

    • JPEG (.jpg, .jpeg) - 12 bpc/arithmetic are not supported.

    • PNG (.png)

    • TGA (.tga)

    hashtag
    __call

    Constructor

    Constructs an instance of this type.

    triangle-exclamation

    Passing an invalid pointer, a or memory region that is smaller than the size will result in a crash.

    Arguments

    1. From file.

    2. From memory.

    3. From RGBA data.

    Returns

    Example


    hashtag
    isAnimated

    FieldRead only

    Type: bool

    Set to true if this is an instance of .


    hashtag
    GetSize

    Method

    Returns size of this texture.

    Arguments

    None.

    Returns

    Example

    C_CSPlayerController

    This type represents a CCSPlayerController class.

    circle-info

    This type inherits type. All of its base methods and fields are also available in this type.

    hashtag

    stage

    ClientFrameStage_t

    Current frame stage.

    setup

    CViewSetup

    View setup information.

    Name

    Type

    Description

    setup

    CViewSetup

    View setup information.

    Name

    Type

    Description

    userCommand

    CUserCmd

    Create move information.

    event

    GameEvent_t

    Game event.

    msg

    int

    System message. Documentationarrow-up-right

    w

    int

    WPARAM.

    l

    int

    LPARAM.

    visible

    boolean

    Whether or not the menu is visible.

    data

    PlayerInfoCallbackData

    The player ESP data

    data

    PlayerInfoCallbackData

    The player ESP data

    here
    mods.events

    ControlType

    This enum determines the current control's type.

    circle-check

    You can only construct types that are listed below in the navigation, and only if those have a constructor.

    hashtag
    DEFAULT

    Field

    Default control. You are very unlikely to ever stumble upon this type.


    hashtag
    BUTTON

    Field

    Button control.


    hashtag
    CHECKBOX

    Field

    Checkbox control.


    hashtag
    CHILD_TAB

    Field

    Child tab control. Only possible to find within tab_layout controls.


    hashtag
    COLOR_PICKER

    Field

    Color picker control.


    hashtag
    COMBO_BOX

    Field

    Combo box control.


    hashtag
    CONTROL_CONTAINER

    Field

    Default control with a container. You are very unlikely to ever stumble upon this type.


    hashtag
    GROUP

    Field

    Groupbox control.


    hashtag
    HOTKEY

    Field

    Hotkey input control.


    hashtag
    HSV_SLIDER

    Field

    HSB slider (Saturation/Brightness box, Hue slider and Opacity slider).


    hashtag
    LABEL

    Field

    Label control.


    hashtag
    LAYOUT

    Field

    Layout control.


    hashtag
    LIST

    Field

    Listbox control.


    hashtag
    LOADING

    Field

    Loading spinner.


    hashtag
    NOTIFICATION_CONTROL

    Field

    Notification item control. One of the types in the core UI framework, never actually used within Fatality.


    hashtag
    POPUP

    Field

    Basic popup window.


    hashtag
    SELECTABLE

    Field

    Basic selectable item.


    hashtag
    SLIDER

    Field

    Slider item. This type doesn't tell the internal value type used.


    hashtag
    SPACER

    Field

    Spacer control.


    hashtag
    TAB

    Field

    Horizontal or vertical tab.


    hashtag
    TABS_LAYOUT

    Field

    A variant of layout that is used specifically to operate tabs.


    hashtag
    WEAPON_TABS_LAYOUT

    Field

    A variant of layout that is used specifically to operate weapon tabs.


    hashtag
    TEXT_INPUT

    Field

    Text input control.


    hashtag
    TOGGLE_BUTTON

    Field

    A variant of button that looks like button, but works like a checkbox.


    hashtag
    WINDOW

    Field

    Basic window control.


    hashtag
    WIDGET

    Field

    Basic widget control.


    hashtag
    SETTINGS

    Field

    Settings control.


    hashtag
    IMAGE

    Field

    Image control.


    hashtag
    LUA

    Field

    Lua control.


    hashtag
    LUA_CONTAINER

    Field

    Lua container control.


    Name

    Type

    Description

    ray

    Ray_t

    The ray/shape

    from

    Vector

    The starting position

    to

    Vector

    The ending position

    ignoreWorld

    boolean

    If true, will ignore the world and only trace against entities.

    Type

    Description

    CGameTrace

    The resulting trace object

    Name

    Type

    Description

    ray

    Ray_t

    The ray/shape

    from

    Vector

    The starting position

    to

    Vector

    The ending position

    Type

    Description

    CGameTrace

    The resulting trace object

    Name

    Type

    Description

    from

    Vector

    The starting position

    to

    Vector

    The ending position

    thrower

    C_BaseEntity

    The entity throwing the grenade, gets skipped

    ignore_breakable

    boolean

    Ignores any breakable objects if true

    Type

    Description

    CGameTrace

    The resulting trace object

    Name

    Type

    Description

    from

    Vector

    The starting position

    to

    Vector

    The ending position

    thrower

    C_BaseEntity

    The entity throwing the grenade, gets skipped

    Type

    Description

    CGameTrace

    The resulting trace object

    Name

    Type

    Description

    tex

    Texture?

    Texture object.

    Name

    Type

    Description

    sh

    Shader?

    Shader object.

    Ptr
    Texture
    SetTexture
    Ptr
    Shader
    SetShader
    Rect
    Rect
    RenderMode

    Name

    Type

    Description

    mvp

    float4x4

    Projection matrix.

    tex

    float2

    Texture dimensions.

    time

    float

    Render time (NOT the frame time).

    alpha

    float

    Global opacity override.

    Name

    Type

    Description

    pos

    float4

    Vertex position on screen (x,y,z over w). Register: SV_POSITION.

    col

    float4

    Vertex color tint (r, g, b, a). Register: COLOR0.

    uv

    float2

    UV coordinates (u, v). Register: TEXCOORD0.

    Name

    Type

    Description

    sampler0

    sampler

    Texture sampler.

    texture0

    Texture2D

    Texture object.

    Name

    Type

    Description

    src

    string

    Shader source code.

    Type

    Description

    Shader

    Shader object.

    Name

    Type

    Description

    name

    string

    Field name.

    Type

    Description

    SchemaAccessor_t

    Accessor instance or pointer accessor instance

    Type

    Description

    string

    Name. Returns nil when failed.

    Type

    Description

    CHandle

    Entity handle

    Type

    Description

    userdata

    Entity pointer

    Type

    Description

    C_CSWeaponBaseGun?

    Casted entity. Returns nil if the cast failed.

    Type

    Description

    C_CSWeaponBase?

    Casted entity. Returns nil if the cast failed.

    Type

    Description

    C_CSPlayerPawn?

    Casted entity. Returns nil if the cast failed.

    Type

    Description

    C_CSPlayerController?

    Casted entity. Returns nil if the cast failed.

    C_CSWeaponBaseGun
    C_CSWeaponBaseGun
    C_CSWeaponBase
    C_CSWeaponBase
    C_CSPlayerPawn
    C_CSPlayerPawn
    C_CSPlayerController
    C_CSPlayerController
    BMP (.bmp) - 1 bpp and RLE variants are not supported.
  • PSD (.psd) - composited view only, no extra channels, 8/16 bpc

  • GIF (.gif) - only first frame, for animated gifs use AnimatedTexture

  • HDR (.hdr)

  • PIC (.pic)

  • PNM (.pnm, .ppm, .pgm) - PPM and PGM are binary only

  • Name

    Type

    Description

    path

    string

    Path to a valid texture file.

    Name

    Type

    Description

    data

    Ptr

    Pointer to texture file data in memory.

    sz

    int

    Size of the texture file data.

    Name

    Type

    Description

    data

    Ptr

    Pointer to RGBA data in memory.

    w

    int

    Width.

    h

    int

    Height (row count).

    p

    int

    Pitch (row width). This is the amount of bytes per row.

    Type

    Description

    texture

    Texture object.

    Type

    Description

    Vec2

    Texture dimensions.

    AnimatedTexture
    local ray = Ray_t()
    local from = Vector(0, 0, 0)
    local to = Vector(100, 100, 100)
    
    local trace = game.physicsQueryInterface:TraceRay(ray, from, to)
    local player = entities.GetLocalPawn()
    local ray = Ray_t() do
        local collision = player.m_pCollision:GetAs('client.dll', 'CCollisionProperty')
        ray:set_hull(collision.m_vecMins:Get(), collision.m_vecMaxs:Get())
    end
    
    local from = player:GetAbsOrigin()
    local to = player:GetAbsOrigin() + player:GetAbsVelocity()
    
    local trace = game.physicsQueryInterface:TraceMovement(ray, from, to)
    cmd:SetTexture(my_tex);
    cmd:SetShader(my_shader);
    cbuffer cb : register(b0) {
        float4x4 mvp;
        float2 tex;
        float time;
        float alpha;
    };
    
    struct PS_INPUT {
        float4 pos : SV_POSITION;
        float4 col : COLOR0;
        float2 uv : TEXCOORD0;
    };
    
    sampler sampler0;
    Texture2D texture0;
    local blur = draw.Shader([[
    // define constant buffer.
    cbuffer cb : register(b0) {
        float4x4 mvp;
        float2 tex;
        float time;
        float alpha;
    };
    
    // define input.
    struct PS_INPUT {
        float4 pos : SV_POSITION;
        float4 col : COLOR0;
        float2 uv : TEXCOORD0;
    };
    
    // use texture sampler and texture.
    sampler sampler0;
    Texture2D texture0;
    
    float4 main(PS_INPUT inp) : SV_Target {
        float radius = 2.0; // blur radius
        float2 inv_size = 1.0 / tex.xy; // inversed size of the texture
        float weight = 0.0; // total weight
        float4 color = 0.0; // total color
    
        // perform a gaussian blur
        for (float x = -radius; x <= radius; x += 1.0)
        {
            for (float y = -radius; y <= radius; y += 1.0)
            {
                float2 coord = inp.uv + float2(x, y) * inv_size;
                color += texture0.Sample(sampler0, coord) * exp(-((x * x + y * y) / (2.0 * radius * radius)));
                weight += exp(-((x * x + y * y) / (2.0 * radius * radius)));
            }
        }
    
        // average the color
        color /= weight;
        color.a *= inp.col.a; // apply alpha modulation
        return color;
    }
    ]]);
    local health = player.m_iHealth;
    local health = player['m_iHealth']; -- this also works
    local name = entity:GetClassName()
    local name = entity:GetHandle()
    local name = entity:GetPointer()
    local gun = entity:ToWeaponBaseGun()
    local wpn = entity:ToWeaponBase()
    local pawn = entity:ToPlayerPawn()
    local controller = entity:ToPlayerController()
    local tex = draw.Texture('funny_meme.png');
    local sz = tex:GetSize();
    IsEnemy

    Method

    Returns true if this player is an enemy to the local player.

    Arguments

    None.

    Returns

    Type

    Description

    bool

    true if an enemy.

    Example


    hashtag
    GetName

    Method

    Returns the sanitized player name.

    Arguments

    None.

    Returns

    Type

    Description

    string

    Player's name.

    Example


    hashtag
    GetPawn

    Method

    Returns the pawn attached to this controller.

    Arguments

    None.

    Returns

    Type

    Description

    Pawn instance.

    Example


    hashtag
    GetActiveWeapon

    Method

    Returns the active weapon.

    Arguments

    None.

    Returns

    Type

    Description

    Weapon instance.

    Example


    hashtag
    GetObserverPawn

    Method

    Returns the observer pawn used for this controller.

    Arguments

    None.

    Returns

    Type

    Description

    ?

    Entity.

    Example


    hashtag
    GetObserverTarget

    Method

    Returns the pawn this controller is currently observing.

    Arguments

    None.

    Returns

    Type

    Description

    ?

    Entity.

    Example


    hashtag
    GetObserverMode

    Method

    Returns the current observer mode.

    Arguments

    None.

    Returns

    Type

    Description

    Observer mode.

    Example


    hashtag
    GetSteamID

    Method

    Returns this player's Steam ID64.

    Arguments

    None.

    Returns

    Type

    Description

    table<number>

    The 64 bits of this player's steam ID, separated in two 32 bit values: low and high.

    Example


    hashtag
    GetStringSteamID

    Method

    Returns this player's Steam ID64, as a string.

    Arguments

    None.

    Returns

    Type

    Description

    string

    The steam ID in string format

    Example

    C_BaseEntity

    draw

    Usage: draw.{func_or_field}

    This table describes the rendering system of the software.

    circle-info

    hashtag

    All types and enums described in the child sections must be prefixed with draw.. This is done so specific types are not confused with others, such as the separate color types present in rendering and the game.

    hashtag
    adapter

    FieldRead only

    Type:

    Rendering adapter.


    hashtag
    textures

    FieldRead only

    Type: <>

    A string to map of all managed textures. You can query and push textures with custom IDs. When you add a texture to this map, it will be automatically destroyed and recreated when required (such as when DX11 device gets lost).

    circle-info

    Built-in textures:

    • gui_loading: loading spinner


    hashtag
    fonts

    FieldRead only

    Type: <>

    A string to map of all managed fonts. You can query and push fonts with custom IDs. When you add a font to this map, it will be automatically destroyed and recreated when required (such as when DX11 device gets lost).

    circle-info

    Built-in fonts:

    • gui_debug: Verdana, 13px


    hashtag
    shaders

    FieldRead only

    Type: <>

    A string to map of all managed shader. You can query and push shader with custom IDs. When you add a shader to this map, it will be automatically destroyed and recreated when required (such as when DX11 device gets lost).

    circle-info

    Build-in shaders:

    • blur_f: gaussian blur shader


    hashtag
    surface

    FieldRead only

    Type:

    The layer you can render on.


    hashtag
    GetTime

    Method

    Returns current render time, alias to .

    Arguments

    None.

    Returns

    Example


    hashtag
    GetFrameTime

    Method

    Returns current frame time, alias to .

    Arguments

    None.

    Returns

    Example


    hashtag
    GetScale

    Method

    Returns current render DPI scaling multiplier.

    Arguments

    None.

    Returns

    Example


    hashtag
    GetDisplay

    Method

    Returns current render screen size, similar to .

    Arguments

    None.

    Returns

    Example


    hashtag
    CreatePanoramaSvgTexture

    Method

    Finds and retrieves SVG data from Panorama and creates a new texture. Useful for retrieving icons (e.g. weapons and utilities) from the game.

    Arguments

    Returns

    Example

    Vec2

    hashtag
    __call

    Constructor

    Creates a new 2D vector instance.

    Arguments

    1. Default vector (0, 0).

    None.

    2. Single value.

    3. XY values.

    Returns

    Example


    hashtag
    x

    Field

    Type: float

    X coordinate.


    hashtag
    y

    Field

    Type: float

    Y coordinate.


    hashtag
    Clone

    Method

    Returns a copy of this vector instance.

    Arguments

    None.

    Returns

    Example


    hashtag
    Floor

    Method

    Returns floored variant of this vector.

    Arguments

    None.

    Returns

    Example


    hashtag
    Ceil

    Method

    Returns ceiled variant of this vector.

    Arguments

    None.

    Returns

    Example


    hashtag
    Round

    Method

    Returns rounded variant of this vector.

    Arguments

    None.

    Returns

    Example


    hashtag
    Len

    Method

    Returns length of this vector.

    Arguments

    None.

    Returns

    Example


    hashtag
    LenSqr

    Method

    Returns squared length of this vector.

    circle-info

    This method is de-facto faster than the non-squared variant. Use it, if you need extra performance.

    Arguments

    None.

    Returns

    Example


    hashtag
    Dist

    Method

    Returns distance to another vector.

    Arguments

    Returns

    Example


    hashtag
    DistSqr

    Method

    Returns squared distance to another vector.

    circle-info

    This method is de-facto faster than the non-squared variant. Use it, if you need extra performance.

    Arguments

    Returns

    Example

    Bits

    This type represents a bitset value.

    triangle-exclamation

    Maximal bit number for this type is 63. Setting or getting any bits outside of that range will cause a crash.

    hashtag
    Reset

    Method

    Resets the value.

    Arguments

    None.

    Returns

    Nothing.

    Example


    hashtag
    GetRaw

    Method

    Returns the raw value.

    Arguments

    None.

    Returns

    Example


    hashtag
    SetRaw

    Method

    Sets the raw value.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    None

    Method

    Returns true if no bits are set.

    Arguments

    None.

    Returns

    Example


    hashtag
    Set

    Method

    Enables a bit.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    Unset

    Method

    Disables a bit.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    Get

    Method

    Returns bit state.

    Arguments

    Returns

    Example


    hashtag
    Toggle

    Method

    Toggles bit state.

    Arguments

    Returns

    Nothing.

    Example

    TextParams

    This type is used to determine text alignment.

    circle-info

    Line alignment only makes sense if you have multiple lines in your text. By default, all next lines will start from the left side of the text. You can change this behavior by using one of the functions that take line as a parameter. For example, if you pass right to the line alignment, all next lines will start from the right side. Text alignment will remain as dictated by v and h parameters.

    CHitboxInfo

    This type encapsulates all of the hitbox information that can be retrieved.

    hashtag
    GetName

    Method

    Returns the name of the hitbox.

    if player:IsEnemy() then
        -- ...
    end
    local name = player:GetName();
    local pawn = ctrl:GetPawn();
    local wep = player:GetActiveWeapon();
    local obs_pawn = ctrl:GetObserverPawn();
    local obs = ctrl:GetObserverTarget();
    local mode = ctrl:GetObserverMode();
    local id = ctrl:GetSteamID();
    print(id.low, id.high);
    local id = ctrl:GetStringSteamID();
    print(id);
    C_CSPlayerPawn
    C_CSWeaponBaseGun
    C_CSPlayerPawn
    C_BaseEntity
    ObserverMode_t

    gui_user_avatar: current user's profile picture. May be nil if you don't have any avatar set

  • gui_icon_up: up chevron

  • gui_icon_down: down chevron

  • gui_icon_copy: copy icon

  • gui_icon_paste: paste icon

  • gui_icon_add: add icon

  • gui_icon_search: search icon

  • gui_icon_settings: settings icon (a cogwheel)

  • gui_icon_bug: bug icon

  • gui_icon_key.N: keyboard/mouse key icons. Replace N with the char code of a required button

  • icon_rage: RAGE tab icon

  • icon_legit: LEGIT tab icon

  • icon_visuals: VISUALS tab icon

  • icon_misc: MISC tab icon

  • icon_scripts: LUA tab icon

  • icon_skins: SKINS tab icon

  • icon_cloud: cloud icon

  • icon_file: file icon

  • icon_refresh: refresh icon

  • icon_save: save icon

  • icon_configs: "Configs" popup icon

  • icon_keys: keyboard icon

  • icon_info: "About" popup icon

  • icon_close: close icon (cross)

  • icon_load: load icon

  • icon_import: import icon

  • icon_export: export icon

  • icon_delete: delete icon

  • icon_autoload: "Autoload" icon

  • icon_allow_insecure: "Allow insecure" icon

  • icon_cloud_upd: cloud update icon

  • player_texture: player preview texture

  • gui_title: Figtree ExtraBold, 23px

  • gui_main: Figtree Medium, 14px

  • gui_main_shadow: Figree Medium, 14px, with shadow

  • gui_main_fb: Segoe UI Semibold, 14px

  • gui_bold: Figtree ExtraBold, 14px

  • gui_bold_fb: Segoe UI Black, 14px

  • gui_semi_bold: Figtree SemiBold, 14px

  • gui_semi_bold_fb: Segoe UI Bold, 14px

  • Type

    Description

    float

    The current time

    Type

    Description

    float

    The frame time

    Type

    Description

    float

    The multiplier

    Type

    Description

    Vec2

    The screen size

    Name

    Type

    Description

    path

    string

    Path to the SVG

    height

    number

    Height of the texture, in pixels

    Type

    Description

    Texture

    The created texture

    Adapter
    Accessor
    Texture
    Texture
    Accessor
    FontBase
    FontBase
    Accessor
    Shader
    Shader
    Layer
    m_flRealTime
    m_flFrameTime
    GetScreenSize()

    Name

    Type

    Description

    value

    float

    X and Y coordinates.

    Name

    Type

    Description

    x

    float

    X coordinate.

    y

    float

    Y coordinate.

    Type

    Description

    Vec2

    New vector.

    Type

    Description

    Vec2

    The copied vector

    Type

    Description

    Vec2

    Floored variant.

    Type

    Description

    Vec2

    Ceiled variant.

    Type

    Description

    Vec2

    Rounded variant.

    Type

    Description

    float

    Length.

    Type

    Description

    float

    Length.

    Name

    Type

    Description

    other

    Vec2

    Other vector.

    Type

    Description

    float

    Distance.

    Name

    Type

    Description

    other

    Vec2

    Other vector.

    Type

    Description

    float

    Distance.

    Type

    Description

    int

    Raw value.

    Name

    Type

    Description

    val

    int

    Raw value.

    Type

    Description

    bool

    true if no bits are set.

    Name

    Type

    Description

    bit

    int

    Bit number.

    Name

    Type

    Description

    bit

    int

    Bit number.

    Name

    Type

    Description

    bit

    int

    Bit number.

    Type

    Description

    bool

    Bit status.

    Name

    Type

    Description

    bit

    int

    Bit number.

    local time = draw.GetTime()
    local time = draw.GetFrameTime()
    local dpi = draw.GetScale()
    local size = draw.GetDisplay()
    local tex = draw.CreatePanoramaSvgTexture('icons/equipment/inferno', 26)
    local vec = draw.Vec2(5, 10);
    local copy = vec:Clone();
    local fl = vec:Floor();
    local ceiled = vec:Ceil();
    local rounded = vec:Round();
    local len = vec:Len();
    local len = vec:LenSqr();
    local dist = vec1:Dist(vec2);
    local dist = vec1:DistSqr(vec2);
    bits:Reset();
    local raw = bits:GetRaw();
    bits:SetRaw(long_long_value);
    if bits:None() then
        -- ...
    end
    bits:Set(5); -- set bit #5 (same as bit.bor(val, bit.lshift(1, 5)))
    bits:Unset(5);
    if bits:Get(5) then
        -- ...
    end
    bits:Toggle(5);
    hashtag
    WithV

    Function

    Creates TextParams instance with vertical alignment.

    Arguments

    Name

    Type

    Description

    v

    Vertical alignment.

    Returns

    Type

    Description

    TextParams

    Created text params.

    Example


    hashtag
    WithH

    Function

    Creates TextParams instance with horizontal alignment.

    Arguments

    Name

    Type

    Description

    h

    Horizontal alignment.

    Returns

    Type

    Description

    TextParams

    Created text params.

    Example


    hashtag
    WithLine

    Function

    Creates TextParams instance with line alignment.

    Arguments

    Name

    Type

    Description

    line

    Line alignment.

    Returns

    Type

    Description

    TextParams

    Created text params.

    Example


    hashtag
    WithVH

    Function

    Creates TextParams instance with vertical and horizontal alignments.

    Arguments

    Name

    Type

    Description

    v

    Vertical alignment.

    h

    Horizontal alignment.

    Returns

    Type

    Description

    TextParams

    Created text params.

    Example


    hashtag
    WithVLine

    Function

    Creates TextParams instance with vertical alignment and line alignment.

    Arguments

    Name

    Type

    Description

    v

    Vertical alignment.

    line

    Line alignment.

    Returns

    Type

    Description

    TextParams

    Created text params.

    Example


    hashtag
    WithHLine

    Function

    Creates TextParams instance with horizontal alignment and line alignment.

    Arguments

    Name

    Type

    Description

    h

    Horizontal alignment.

    line

    Line alignment.

    Returns

    Type

    Description

    TextParams

    Created text params.

    Example


    hashtag
    WithVHLine

    Function

    Creates TextParams instance with vertical, horizontal and line alignments.

    Arguments

    Name

    Type

    Description

    v

    Vertical alignment.

    h

    Horizontal alignment.

    line

    Line alignment.

    Returns

    Type

    Description

    TextParams

    Created text params.

    Example

    Arguments

    None.

    Returns

    Type

    Description

    string

    The name

    Example


    hashtag
    GetSurfaceProperty

    Method

    Returns the hitbox's surface property.

    Arguments

    None.

    Returns

    Type

    Description

    string

    The hitbox property

    Example


    hashtag
    GetBoneName

    Method

    Returns the hitbox's bone name.

    Arguments

    None.

    Returns

    Type

    Description

    string

    The hitbox bone

    Example


    hashtag
    GetMinBounds

    Method

    Returns the hitbox's minimum bounds.

    Arguments

    None.

    Returns

    Type

    Description

    The mins

    Example


    hashtag
    GetMaxBounds

    Method

    Returns the hitbox's maximum bounds.

    Arguments

    None.

    Returns

    Type

    Description

    The maxs

    Example


    hashtag
    GetShapeRadius

    Method

    Returns the hitbox's radius.

    Arguments

    None.

    Returns

    Type

    Description

    number

    The radius

    Example


    hashtag
    GetBoneNameHash

    Method

    Returns the hitbox's name hash.

    Arguments

    None.

    Returns

    Type

    Description

    number

    The hash

    Example


    hashtag
    GetGroupID

    Method

    Returns the hitbox's group ID.

    Arguments

    None.

    Returns

    Type

    Description

    number

    The ID

    Example


    hashtag
    IsTranslationOny

    Method

    Returns whether the hitbox only translates or not.

    Arguments

    None.

    Returns

    Type

    Description

    boolean

    The ID

    Example


    hashtag
    GetCRC

    Method

    Returns the hitbox's CRC value.

    Arguments

    None.

    Returns

    Type

    Description

    number

    The CRC

    Example


    hashtag
    GetRenderColor

    Method

    Returns the hitbox's rendering color. Not really useful.

    Arguments

    None.

    Returns

    Type

    Description

    userdata

    The color

    Example


    hashtag
    GetHitboxIndex

    Method

    Returns the hitbox's unique index.

    Arguments

    None.

    Returns

    Type

    Description

    number

    The index

    Example

    C_CSWeaponBaseGun

    This type represents a CCSWeaponBaseGun class.

    circle-info

    This type inherits C_BaseEntity type. All of its base methods and fields are also available in this type.

    hashtag
    GetAbsOrigin

    Method

    Returns the absolute origin (the one that is used for rendering).

    Arguments

    None.

    Returns

    Example


    hashtag
    GetMaxSpeed

    Method

    Returns the maximal player speed when holding this weapon.

    Arguments

    None.

    Returns

    Example


    hashtag
    GetInaccuracy

    Method

    Returns the current inaccuracy value.

    Arguments

    Returns

    Example


    hashtag
    GetSpread

    Method

    Returns the current spread value.

    Arguments

    Returns

    Example


    hashtag
    GetDefIndex

    Method

    Returns the weapon definition index.

    Arguments

    None.

    Returns

    Example


    hashtag
    GetType

    Method

    Returns the weapon type.

    Arguments

    None.

    Returns

    Example


    hashtag
    GetData

    Method

    Returns the weapon static data.

    Arguments

    None.

    Returns

    Example


    hashtag
    IsGun

    Method

    Returns true if this weapon is a firearm.

    Arguments

    None.

    Returns

    Example


    hashtag
    IsAttackable

    Method

    Returns true if you can attack with this weapon.

    Arguments

    None.

    Returns

    Example


    hashtag
    HasSecondaryAttack

    Method

    Returns true if this weapon has a secondary attack mode.

    Arguments

    None.

    Returns

    Example


    hashtag
    HasSpread

    Method

    Returns true if this weapon has spread (e.g. knives do not have any spread).

    Arguments

    None.

    Returns

    Example

    local align_top = draw.TextParams.WithV(draw.TextAlignment.TOP);
    local align_right = draw.TextParams.WithH(draw.TextAlignment.RIGHT);
    local lines_center = draw.TextParams.WithLine(draw.TextAlignment.CENTER);
    local align_bottom_right = draw.TextParams.WithVH(draw.TextAlignment.BOTTOM, draw.TextAlignment.RIGHT);
    local align = draw.TextParams.WithVLine(draw.TextAlignment.BOTTOM, draw.TextAlignment.CENTER);
    local align = draw.TextParams.WithHLine(draw.TextAlignment.CENTER, draw.TextAlignment.CENTER);
    local align = draw.TextParams.WithVHLine(draw.TextAlignment.CENTER, draw.TextAlignment.CENTER, draw.TextAlignment.CENTER);
    local hbox_name = hitbox:GetName();
    local prop = hitbox:GetSurfaceProperty();
    local bone_name = hitbox:GetBoneName();
    local mins = hitbox:GetMinBounds();
    local maxs = hitbox:GetMaxBounds();
    local radius = hitbox:GetShapeRadius();
    local hash = hitbox:GetBoneNameHash();
    local id = hitbox:GetGroupID();
    local translate = hitbox:IsTranslationOny();
    local crc = hitbox:GetCRC();
    local crc = hitbox:GetRenderColor();
    local hbox_index = hitbox:GetHitboxIndex();
    TextAlignment
    TextAlignment
    TextAlignment
    TextAlignment
    TextAlignment
    TextAlignment
    TextAlignment
    TextAlignment
    TextAlignment
    TextAlignment
    TextAlignment
    TextAlignment
    Vector
    Vector

    Type

    Description

    Vector

    Origin.

    Type

    Description

    float

    Max speed, in UPS.

    Name

    Type

    Description

    mode

    CSWeaponMode

    Weapon mode.

    Type

    Description

    float

    Inaccuracy value.

    Name

    Type

    Description

    mode

    CSWeaponMode

    Weapon mode.

    Type

    Description

    float

    Inaccuracy value.

    Type

    Description

    EItemDefinitionIndex

    Weapon ID.

    Type

    Description

    CSWeaponType

    Weapon type.

    Type

    Description

    CCSWeaponBaseVData

    Weapon data.

    Type

    Description

    bool

    true if a firearm.

    Type

    Description

    bool

    true if can attack.

    Type

    Description

    bool

    true if has the secondary attack mode.

    Type

    Description

    bool

    true if has spread.

    local org = wep:GetAbsOrigin();
    local spd = wep:GetMaxSpeed();
    local inacc = wep:GetInaccuracy(CSWeaponMode.PRIMARY_MODE);
    local spread = wep:GetSpread(CSWeaponMode.PRIMARY_MODE);
    local wep_id = wep:GetID();
    local type = wep:GetType();
    local data = wep:GetData();
    if wep:IsGun() then
        -- ...
    end
    if wep:IsAttackable() then
        -- ...
    end
    if wep:HasSecondaryAttack() then
        -- ...
    end
    if wep:HasSpread() then
        -- ...
    end

    math

    Usage: math.{func}

    This table extends the existing math table that is a part of Lua.

    hashtag
    CalcAngle

    Function

    Calculates angles between 2 vectors.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    AngleNormalize

    Function

    Normalizes an angle.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    ApproachAngles

    Function

    Approaches an angle over time.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    EdgePoint

    Function

    Returns a point on the edge of a box.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    Lerp

    Function

    Linear interpolation.

    Arguments

    Name
    Type
    Description

    Returns

    Example


    hashtag
    VectorAngles

    Function

    Calculates angles from a vector.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    WorldToScreen

    Function

    Transforms a point in the game world onto the viewport.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    Clamp

    Function

    Clamps a value between min and max.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    RemapVal

    Function

    Maps the value from one range to another range.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    RemapValClamped

    Function

    Maps the value from one range to another range. Additionally, clamps the value based on the source range.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    Vec2

    Function

    An alias to .

    Example


    hashtag
    Vec3

    Function

    An alias to .

    Example

    FontBase

    This type represents the base class for font types. You cannot create an instance of this type. Instead, use the children types.

    circle-info

    This type inherits Managed type. All of its base methods and fields are also available in this type.

    circle-info

    Definitions:

    • codepoint: Unicode representation of the character.

    • kerning: a distance between two characters.

    • glyph: visual representation of a character.

    hashtag
    height

    FieldRead only

    Type: float

    Font height, in pixels.


    hashtag
    ascent

    Field

    Type: float

    Font ascent value, in pixels.


    hashtag
    descent

    Field

    Type: float

    Font descent value, in pixels.


    hashtag
    lineGap

    Field

    Type: float

    Font line gap, in pixels.


    hashtag
    kerningGap

    Field

    Type: float

    Font kerning gap, in pixels.


    hashtag
    outlineAlpha

    Field

    Type: float

    Font outline opacity (0 to 1). Defaults to 0.45.


    hashtag
    flags

    FieldRead only

    Type:

    Font flags. Use bit library to read flags.


    hashtag
    yOffset

    Field

    Type: int

    Glyph Y offset, in pixels. Will alter the location of a glyph in the atlas. Changing this value after the font was created is meaningless.


    hashtag
    xOffset

    Field

    Type: int

    Glyph X offset, in pixels. Will alter the location of a glyph in the atlas. Changing this value after the font was created is meaningless.


    hashtag
    fallbackFont

    Field

    Type: FontBase

    Fallback font to use, in case a glyph is not found in this font. Is it useful when one font does not have codepoints for specific symbols, that are present in another font, but you still want to prefer this font's glyphs over other font.


    hashtag
    dropshadowColor

    Field

    Type:

    Shadow color. Only R, G, B values are used.


    hashtag
    GetKernedCharWidth

    Method

    Returns character width, included with kerning.

    Arguments

    Returns

    Example


    hashtag
    GetKerning

    Method

    Returns kerning value for a single character. If kerning is disabled, will instead return kerning gap.

    Arguments

    Returns

    Example


    hashtag
    GetTextSize

    Method

    Returns text area size.

    Arguments

    Returns

    Example


    hashtag
    WrapText

    Method

    Wraps text to meet the desired width. Wrapping is done by breaking text by words and inserting line breaks in between. If one of the words is longer than the target width, will instead use that word's width.

    Arguments

    Returns

    Example


    hashtag
    GetGlyph

    Method

    Returns glyph information for a character.

    Arguments

    Returns

    Example


    hashtag
    GetTexture

    Method

    Returns a texture atlas that contains the provided glyph.

    Arguments

    Returns

    Example

    gui

    Usage:

    gui.{func_or_field}

    Usage: gui.{func_or_field}

    This table exposes the GUI system of the software.

    circle-info

    All types and enums described in the child sections must be prefixed with gui..

    hashtag
    ctx

    Field

    Type:

    GUI context.


    hashtag
    notify

    Field

    Type:

    Notification system.


    hashtag
    input

    Field

    Type:

    Input context.


    hashtag
    MakeControl

    Function

    Wraps a control into a layout consisting of a label and that specific control. You should add this new control to groupboxes if you want your control to be displayed nicely. Additionally, you can add any extra controls to the returned one - those will get stacked to the left side of your initial control.

    Arguments

    Returns

    Example


    hashtag
    MakeControlEasy

    Function

    A quick wrapper for MakeControl , returns both the menu element and control.

    circle-info

    Available types are:

    Arguments

    Returns

    Example


    hashtag
    MakeStackedGroups

    Function

    Creates a vertical stack with two or more .

    Arguments

    Returns

    Example


    hashtag
    IsVisible

    Function

    Returns whether or not the menu is currently open.

    Returns

    Example


    hashtag
    GetActiveOverridePath

    Function

    Returns the current ragebot/legitbot weapon or category path.

    circle-exclamation

    Should only be called when you're alive, causes undefined behavior otherwise.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    GetMainWindow

    Function

    Returns the menu's main window.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    GetHotkeyList

    Function

    Returns list of all controls with hotkeys currently added.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    GetThemeColors

    Function

    Returns list of all colors being used the GUI theme.

    circle-info

    Available keys are

    Arguments

    None.

    Returns

    Type
    Description

    Example

    d

    float

    Highest destination value.

    d

    float

    Highest destination value.

    src

    Vector

    Source vector.

    dst

    Vector

    Destination vector.

    Vector

    Angles.

    angle

    float

    Input angle.

    float

    Normalized angle.

    from

    Vector

    Start angle.

    to

    Vector

    End angle.

    speed

    float

    Approach speed.

    Vector

    Delta angle.

    mins

    Vector

    Box mins.

    maxs

    Vector

    Box maxs.

    dir

    Vector

    Point direction (angle).

    radius

    float

    Area radius.

    Vector

    Point.

    t1

    float

    Start value.

    t2

    float

    End value.

    progress

    float

    Interpolation amount.

    Type

    Description

    float

    Interpolated value.

    forward

    Vector

    Source vector.

    up

    Vector

    Up vector. Defaults to nil.

    Vector

    Angles.

    xyz

    Vector

    Point in the world.

    round

    bool

    Whether should round the output. Defaults to true.

    Vec2

    Point on the viewport.

    n

    float

    Value.

    lower

    float

    Lowest value.

    upper

    float

    Highest value.

    float

    Clamped value.

    val

    float

    Value.

    a

    float

    Lowest source value.

    b

    float

    Highest source value.

    c

    float

    Lowest destination value.

    float

    Mapped value.

    val

    float

    Value.

    a

    float

    Lowest source value.

    b

    float

    Highest source value.

    c

    float

    Lowest destination value.

    float

    Mapped value.

    draw.Vec2
    Vector

    Name

    Type

    Description

    left

    int

    Previous character codepoint.

    right

    int

    Current character codepoint.

    Type

    Description

    float

    Distance, in pixels.

    Name

    Type

    Description

    cp

    int

    Codepoint.

    Type

    Description

    float

    Kerning value, in pixels.

    Name

    Type

    Description

    text

    string

    Text.

    skip_scaling

    bool

    If set to true, will skip global DPI scaling. Defaults to false.

    til_newline

    bool

    Calculate size only until a line break is met. Defaults to false.

    Type

    Description

    Vec2

    Text area size.

    Name

    Type

    Description

    text

    string

    Text to wrap.

    width

    float

    Target width.

    Type

    Description

    string

    Wrapped text.

    Name

    Type

    Description

    codepoint

    int

    Codepoint.

    Type

    Description

    Glyph_t

    Glyph information.

    Name

    Type

    Description

    gl

    Glyph_t

    Character glyph.

    Type

    Description

    int

    Texture pointer, or nil if not found.

    FontFlags
    Color

    Name

    Type

    Description

    text

    string

    Label value.

    c

    Control

    Control object.

    Type

    Description

    Layout

    Layout object.

    Name

    Type

    Description

    id

    string

    ID.

    label

    string

    Label value.

    type

    string

    The type of this control

    ...

    any...

    Extra constructor arguments

    Type

    Description

    any

    Menu element (checkbox, slider etc.)

    Control

    Control

    Name

    Type

    Description

    id

    ControlID|string

    ID

    size

    Vec2

    Size

    groups

    table<Group>

    List of group boxes

    Type

    Description

    Layout

    Group stack object.

    Type

    Description

    boolean

    If menu is visible or not

    string

    The path currently being used by the ragebot or legitbot

    Window

    The window object.

    table<Control>

    All controls currently with keybinds set

    table<Color>

    All menu colors

    Context
    NotificationSystem
    ContextInput
    group boxes
    local ang = math.CalcAngle(vec1, vec2);
    local norm = math.AngleNormalize(560);
    local ang = math.ApproachAngles(from, to, 1.0 / game.globalVars.frame_time);
    local point = math.EdgePoint(mins, maxs, dir, 5);
    local mid = math.Lerp(0, 100, 0.5);
    local ang = math.VectorAngles(fw);
    local point = math.WorldToScreen(game_point);
    local x = math.Clamp(50, 5, 25); -- 25
    local mapped = math.RemapVal(0.5, 0, 1, 0, 100); -- 50
    local mapped = math.RemapValClamped(5, 0, 1, 0, 100); -- 100
    local vec = math.Vec2(5, 5);
    local vec = math.Vec3(5, 12, 5);
    local w = font:GetKernedCharWidth(prev_cp, cp);
    local k = font:GetKerning(cp);
    local sz = font:GetTextSize('Hello!');
    local shorter = font:WrapText('This is some very long text!', 50);
    local glyph = font:GetGlyph(cp);
    local atlas = font:GetTexture(glyph);
    local row = gui.MakeControl('Hello checkbox!', my_cb);
    checkbox
    slider
    color_picker
    text_input
    combo_box
    local slider, slider_ctrl = gui.MakeControlEasy('my_slider', 'Slider', 'slider', 0, 100);
    local grp1 = gui.Group('grp1', 'My group 1', 150, gui.GroupWidthMode.DEFAULT);
    local grp2 = gui.Group('grp2', 'My group 2', 150, gui.GroupWidthMode.DEFAULT);
    
    local stack = gui.MakeStackedGroups("grp12", draw.vec2(234, 400), {
        grp1, grp2
    });
    if gui.IsVisible() then
        print('Menu is open!')
    end
    local override_path = gui.GetActiveOverridePath()
    local hitchance = gui.ctx:Find(override_path .. '>weapon>hitchance')
    local wnd = gui.GetMainWindow()
    local pos = wnd:GetPosAbs()
    local controls = gui.GetHotkeyList()
    for i, control in ipairs(controls) do
        local element = control:Cast() -- Convert to its parent type
        if element:GetHotkeyState() then
            print('overriding ' .. element:GetLabel().text,
                  'value ' .. tostring(element:GetValue():Get()))
        end
    end
    title1, title2, accent, accent2, text, textLight, textMid, textDark, bgBottom, bgBlock, bgBlock2, bgBlockSelectedTab, accentOutline, bgBlockLight, bgOdd, bgEven, outline, outlineLight, warning, danger, success, untrusted
    local colors = gui.GetThemeColors()
    
    draw.surface:AddRect(draw.Rect(0, 0, 100, 100), colors.accent)

    Control

    This type represents an abstract GUI control.

    hashtag
    id

    FieldRead only

    Type: int

    Control ID.


    hashtag
    idString

    FieldRead only

    Type: string

    String representation of control's ID. This may be empty for some controls.


    hashtag
    isVisible

    FieldRead only

    Type: bool

    Control's visibility state.


    hashtag
    parent

    FieldRead only

    Type: control?

    Parent control. Might be nil on some controls.


    hashtag
    type

    FieldRead only

    Type:

    Control's type.


    hashtag
    inactive

    Field

    Type: bool

    If set to true, will mark this control to the inactive state.


    hashtag
    inactiveText

    Field

    Type: string

    Tooltip replacement to show when control is inactive.


    hashtag
    inactiveColor

    Field

    Type:

    Label color override for inactive controls.


    hashtag
    tooltip

    Field

    Type: string

    Tooltip text.


    hashtag
    pos

    Field

    Type:

    Relative position of this control


    hashtag
    size

    Field

    Type:

    Total size of this control


    hashtag
    sizeToParentW

    Field

    Type: boolean

    Whether or not the width of this control is locked to it's parent container


    hashtag
    sizeToParentH

    Field

    Type: boolean

    Whether or not the height of this control is locked to it's parent container


    hashtag
    isTakingInput

    Field

    Type: boolean

    circle-exclamation

    May not be available for all controls.

    Whether or not this control handles input in any way.


    hashtag
    isTakingKeys

    Field

    Type: boolean

    circle-exclamation

    May not be available for all controls.

    Whether or not this control is listening to generic key presses.


    hashtag
    isTakingText

    Field

    Type: boolean

    circle-exclamation

    May not be available for all controls.

    Whether or not this control is listening and handling text input.


    hashtag
    margin

    Field

    Type: rect

    The margin/offset to the parent container. Left, top, right and bottom, respectively.


    hashtag
    isMouseOnMe

    Field

    Type: boolean

    circle-exclamation

    May not be available for all controls.

    Whether or not the user is hovering this control.


    hashtag
    aliases

    Field

    Type: table[string]

    Alias list for this control. Used in search box to support different naming (e.g. if a user searches for "Double tap", will find "Rapid fire" instead).


    hashtag
    GetPosAbs

    Method

    Returns this control's position relative to the screen origin (0, 0).

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    GetArea

    Method

    Returns a rectangle containing the area of this control relative to the current container.

    Arguments

    Returns

    Type
    Description

    Example


    hashtag
    GetAreaAbs

    Method

    Returns a rectangle containing the area of this control relative to the screen origin (0, 0).

    Arguments

    Returns

    Type
    Description

    Example


    hashtag
    GetLabel

    Method

    Returns the label of this control in the menu.

    circle-exclamation

    This does not work for types. Use the text field instead.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    GetHotkeyState

    Method

    Returns true if any of the control's hotkeys are active.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    HasHotkeys

    Method

    Returns true if this control has any hotkeys.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    SetDimensions

    Method

    Overrides the offset and size for this control.

    circle-info

    This method does not override sizeToParentW and sizeToParentH.

    Arguments

    Returns

    Nothing.

    Example

    hashtag
    SetVisible

    Method

    Changes visibility state for this control.

    triangle-exclamation

    Calling this method on controls that are located in layouts with large amount of other controls will inevitably cause performance issues due to auto-stacking.

    Arguments

    Name
    Type
    Description

    Returns

    Nothing.

    Example


    hashtag
    AddCallback

    Method

    Adds a callback to this control.

    Arguments

    Name
    Type
    Description

    Returns

    Nothing.

    Example


    hashtag
    Cast

    Method

    Attempts to downcast the control to the correct type.

    circle-check

    Due to Lua engine's limitations, it is impossible to automatically downcast variables. Usually there is no need to call this method, unless you found some control that wasn't somehow already cast to the desired type. find() methods automatically perform the cast to the correct type.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    Reset

    Method

    Resets control's state. This action is usually required if you change control's value directly by interacting with .

    You also should call this method on layouts if you add multiple controls into them.

    Arguments

    None.

    Returns

    Nothing.

    Example


    C_CSPlayerPawn

    This type represents a C_CSPlayerPawn class.

    circle-info

    This type inherits type. All of its base methods and fields are also available in this type.

    hashtag

    Vec2

    Absolute position of this control.

    Name

    Type

    Description

    includeMargin

    boolean

    Whether or not to include the margin in the area.

    Rect

    Area of this control in container space.

    Name

    Type

    Description

    includeMargin

    boolean

    Whether or not to include the margin in the area.

    Rect

    Area of this control in screen space.

    Label

    Control label, if any.

    bool

    true if any hotkey is active.

    bool

    true if control has hotkeys.

    Name

    Type

    Description

    position

    Vec2

    Offset

    size

    Vec2

    Size

    val

    bool

    Visibility state.

    cbk

    function

    Callback.

    <control>

    New type, if any.

    ControlType
    Color
    Vec2
    Vec2
    label
    ValueParam
    local screen_pos = ctrl:GetPosAbs();
    local area = ctrl:GetArea();
    local screen_area = ctrl:GetAreaAbs();
    local text = ctrl:GetLabel().text;
    if ctrl:GetHotkeyState() then
        -- ...
    end
    if ctrl:HasHotkeys() then
        -- ...
    end
    control:SetDimensions(draw.Vec2(), draw.Vec2(100, 24))
    ctrl:SetVisible(false);
    ctrl:AddCallback(function ()
        print('Callback invoked!');
    end);
    local checkbox = maybe_checkbox:Cast();
    ctrl:Reset();
    ShouldDraw

    Method

    Returns true if the game will draw this player on screen.

    Arguments

    None.

    Returns

    Type

    Description

    bool

    true if will.

    Example


    hashtag
    IsLeftHanded

    Method

    Returns true if left-hand mode is enabled.

    Arguments

    None.

    Returns

    Type

    Description

    bool

    true if left-handed.

    Example


    hashtag
    GetAbsOrigin

    Method

    Returns the absolute origin (the one that is used for rendering).

    Arguments

    None.

    Returns

    Type

    Description

    Origin.

    Example


    hashtag
    GetAbsAngles

    Method

    Returns the absolute angles (the one that is used for rendering).

    Arguments

    None.

    Returns

    Type

    Description

    Angles.

    Example


    hashtag
    GetAbsVelocity

    Method

    Returns the absolute velocity.

    Arguments

    None.

    Returns

    Type

    Description

    Velocity.

    Example


    hashtag
    SetAbsOrigin

    Method

    Sets the new absolute origin.

    Arguments

    Name

    Type

    Description

    vec

    New origin.

    Returns

    Nothing.

    Example


    hashtag
    SetAbsAngles

    Method

    Sets new absolute angles.

    Arguments

    Name

    Type

    Description

    ang

    New angles.

    Returns

    Nothing.

    Example


    hashtag
    SetAbsVelocity

    Method

    Sets new absolute velocity.

    Arguments

    Name

    Type

    Description

    vel

    New velocity.

    Returns

    Nothing.

    Example


    hashtag
    IsAlive

    Method

    Returns true if the player is alive.

    Arguments

    None.

    Returns

    Type

    Description

    bool

    true if alive.

    Example


    hashtag
    IsEnemy

    Method

    Returns true if this player is an enemy to the local player.

    Arguments

    None.

    Returns

    Type

    Description

    bool

    true if an enemy.

    Example


    hashtag
    IsEnemyTo

    Method

    Returns whether this player is an enemy to another entity.

    Arguments

    Name

    Type

    Description

    ent

    Other entity.

    Returns

    Type

    Description

    bool

    true if an enemy.

    Example


    hashtag
    GetActiveWeapon

    Method

    Returns the active weapon.

    Arguments

    None.

    Returns

    Type

    Description

    Weapon instance.

    Example


    hashtag
    GetWeapons

    Method

    Returns all weapons in this player's inventory.

    Arguments

    None.

    Returns

    Type

    Description

    table<>

    Weapon list

    Example


    hashtag
    GetName

    Method

    Returns the sanitized player name.

    Arguments

    None.

    Returns

    Type

    Description

    string

    Player's name.

    Example


    hashtag
    GetViewOffset

    Method

    Returns the player's view offset (eye location relative to the player's origin).

    Arguments

    None.

    Returns

    Type

    Description

    View offset.

    Example


    hashtag
    GetEyePos

    Method

    Returns the player's eye position.

    Arguments

    None.

    Returns

    Type

    Description

    Eye position.

    Example


    hashtag
    GetHitbox

    Method

    Returns hitbox information for a specific hitbox. Not to be confused with GetHitboxCenter.

    Arguments

    Name

    Type

    Description

    index

    The hitbox ID

    Returns

    Type

    Description

    Hitbox info

    Example


    hashtag
    GetHitboxCenter

    Method

    Returns hitbox position for a specific hitbox.

    Arguments

    Name

    Type

    Description

    index

    The hitbox ID

    Returns

    Type

    Description

    The position

    Example


    hashtag
    GetBoundingBox

    Method

    Returns the bounding box rectangle for this player. Returns nil if the player is not on screen.

    circle-info

    If you wish to add new items to the built-in visuals, look at the playerInfo callback.

    Arguments

    None.

    Returns

    Type

    Description

    Player's bounding box, nil if invalid.

    Example

    C_BaseEntity

    ContextInput

    This type represents the GUI input context.

    circle-info

    You can use Cursor, IsMouseUp, IsMouseDown, IsKeyUp and IsKeyDown methods outside input context. Using other methods will not make any sense, as the information will be outdated.

    hashtag
    Cursor

    Method

    Returns current cursor position.

    Arguments

    None.

    Returns

    Example


    hashtag
    CursorPrev

    Method

    Returns previous cursor position.

    Arguments

    None.

    Returns

    Example


    hashtag
    CursorDelta

    Method

    Delta value between previous and current cursor positions.

    Arguments

    None.

    Returns

    Example


    hashtag
    DidCursorMove

    Method

    Returns true if the cursor did move since the last input.

    Arguments

    None.

    Returns

    Example


    hashtag
    DidWheelMove

    Method

    Returns true if mouse scroll wheel did move since the last input.

    Arguments

    None.

    Returns

    Example



    hashtag
    DidProcessMouse

    Method

    Returns true if any mouse key's state had changed.

    Arguments

    None.

    Returns

    Example



    hashtag
    ButtonReleased

    Method

    Returns true if any key was released since the last input.

    Arguments

    None.

    Returns

    Example



    hashtag
    WheelDelta

    Method

    Returns the amount of rows scrolled this input.

    Arguments

    None.

    Returns

    Example


    hashtag
    IsMouseUp

    Method

    Returns true if the mouse key is up (depressed).

    Arguments

    Returns

    Example


    hashtag
    IsMouseDown

    Method

    Returns true if the mouse key is down (pressed).

    Arguments

    Returns

    Example


    hashtag
    IsMouseClicked

    Method

    Returns true if the mouse key is clicked (switched from depressed to pressed state).

    Arguments

    Returns

    Example


    hashtag
    IsMouseReleased

    Method

    Returns true if the mouse key is released (switched from pressed to depressed state).

    Arguments

    Returns

    Example


    hashtag
    DidProcessKey

    Method

    Returns true if any key's state had changed.

    Arguments

    None.

    Returns

    Example


    hashtag
    IsKeyUp

    Method

    Returns true if a key is up (depressed).

    Arguments

    Returns

    Example


    hashtag
    IsKeyDown

    Method

    Returns true if a key is down (pressed).

    Arguments

    Returns

    Example


    hashtag
    IsKeyClicked

    Method

    Returns true if a key is clicked (switched from depressed to pressed state).

    Arguments

    Returns

    Example


    hashtag
    IsKeyReleased

    Method

    Returns true if a key is released (switched from pressed to depressed state).

    Arguments

    Returns

    Example

    EItemDefinitionIndex

    This enum represents the unique identifier for various weapons in the game.

    hashtag
    NONE

    Field

    if player:ShouldDraw() then
        -- ...
    end
    if player:IsLeftHanded() then
        -- ...
    end
    local org = player:GetAbsOrigin();
    local ang = player:GetAbsAngles();
    local vel = player:GetAbsVelocity();
    player:SetAbsOrigin(my_vec);
    player:SetAbsAngles(my_ang);
    player:SetAbsVelocity(my_vel);
    if player:IsAlive() then
        -- ...
    end
    if player:IsEnemy() then
        -- ...
    end
    if player:IsEnemyTo(other_player) then
        -- ...
    end
    local wep = player:GetActiveWeapon();
    local weapons = player:GetWeapons();
    for i, v in ipairs(weapons) do
        print(v:get_id())
    end
    local name = player:GetName();
    local vo = player:GetViewOffset();
    local eyes = player:GetEyePos();
    local hbox_info = player:GetHitbox(EHitBox.HEAD);
    local pelvis = player:GetHitboxCenter(EHitBox.PELVIS);
    local bbox = player:GetBoundingBox();
    Represents no weapon.

    hashtag
    DEAGLE

    Field

    Represents a Desert Eagle.


    hashtag
    ELITE

    Field

    Represents the Dual Berettas.


    hashtag
    FIVESEVEN

    Field

    Represents a Five-SeveN.


    hashtag
    GLOCK

    Field

    Represents a Glock-18.


    hashtag
    AK47

    Field

    Represents an AK-47.


    hashtag
    AUG

    Field

    Represents an AUG.


    hashtag
    AWP

    Field

    Represents an AWP.


    hashtag
    FAMAS

    Field

    Represents a FAMAS.


    hashtag
    G3SG1

    Field

    Represents a G3SG1.


    hashtag
    GALILAR

    Field

    Represents a Galil AR.


    hashtag
    M249

    Field

    Represents an M249.


    hashtag
    M4A1

    Field

    Represents an M4A4.


    hashtag
    MAC10

    Field

    Represents a MAC-10.


    hashtag
    P90

    Field

    Represents a P90.


    hashtag
    ZONE_REPULSOR

    Field

    Represents a zone repulsor device.


    hashtag
    MP5SD

    Field

    Represents an MP5-SD.


    hashtag
    UMP45

    Field

    Represents a UMP-45.


    hashtag
    XM1014

    Field

    Represents an XM1014.


    hashtag
    BIZON

    Field

    Represents a PP-Bizon.


    hashtag
    MAG7

    Field

    Represents a MAG-7.


    hashtag
    NEGEV

    Field

    Represents a Negev.


    hashtag
    SAWEDOFF

    Field

    Represents a Sawed-Off.


    hashtag
    TEC9

    Field

    Represents a Tec-9.


    hashtag
    TASER

    Field

    Represents a Zeus x27 taser.


    hashtag
    HKP2000

    Field

    Represents a P2000.


    hashtag
    MP7

    Field

    Represents an MP7.


    hashtag
    MP9

    Field

    Represents an MP9.


    hashtag
    NOVA

    Field

    Represents a Nova.


    hashtag
    P250

    Field

    Represents a P250.


    hashtag
    SHIELD

    Field

    Represents a shield.


    hashtag
    SCAR20

    Field

    Represents a SCAR-20.


    hashtag
    SG556

    Field

    Represents an SG 553.


    hashtag
    SSG08

    Field

    Represents an SSG 08.


    hashtag
    KNIFEGG

    Field

    Represents the Golden Knife.


    hashtag
    KNIFE

    Field

    Represents the default knife.


    hashtag
    FLASHBANG

    Field

    Represents a flashbang.


    hashtag
    HEGRENADE

    Field

    Represents an HE grenade.


    hashtag
    SMOKEGRENADE

    Field

    Represents a smoke grenade.


    hashtag
    MOLOTOV

    Field

    Represents a Molotov.


    hashtag
    DECOY

    Field

    Represents a decoy grenade.


    hashtag
    INCGRENADE

    Field

    Represents an incendiary grenade.


    hashtag
    C4

    Field

    Represents a C4 explosive.


    hashtag
    HEALTHSHOT

    Field

    Represents a health shot.


    hashtag
    KNIFE_T

    Field

    Represents the Terrorist knife.


    hashtag
    M4A1_SILENCER

    Field

    Represents the M4A1-S.


    hashtag
    USP_SILENCER

    Field

    Represents the USP-S.


    hashtag
    CZ75A

    Field

    Represents a CZ75-Auto.


    hashtag
    REVOLVER

    Field

    Represents an R8 Revolver.


    hashtag
    TAGRENADE

    Field

    Represents a tactical awareness grenade.


    hashtag
    FISTS

    Field

    Represents fists.


    hashtag
    BREACHCHARGE

    Field

    Represents a breach charge.


    hashtag
    TABLET

    Field

    Represents a tablet.


    hashtag
    MELEE

    Field

    Represents a generic melee weapon.


    hashtag
    AXE

    Field

    Represents an axe.


    hashtag
    HAMMER

    Field

    Represents a hammer.


    hashtag
    SPANNER

    Field

    Represents a spanner (wrench).


    hashtag
    KNIFE_GHOST

    Field

    Represents a ghost knife.


    hashtag
    FIREBOMB

    Field

    Represents a firebomb grenade.


    hashtag
    DIVERSION

    Field

    Represents a diversion device.


    hashtag
    FRAGGRENADE

    Field

    Represents a fragmentation grenade.


    hashtag
    SNOWBALL

    Field

    Represents a snowball.


    hashtag
    BUMPMINE

    Field

    Represents a bump mine.


    hashtag
    KNIFE_BAYONET

    Field

    Represents a Bayonet.


    hashtag
    KNIFE_CSS

    Field

    Represents the Classic Knife.


    hashtag
    KNIFE_FLIP

    Field

    Represents a Flip Knife.


    hashtag
    KNIFE_GUT

    Field

    Represents a Gut Knife.


    hashtag
    KNIFE_KARAMBIT

    Field

    Represents a Karambit.


    hashtag
    KNIFE_M9BAYONET

    Field

    Represents an M9 Bayonet.


    hashtag
    KNIFE_TACTICAL

    Field

    Represents a Huntsman Knife.


    hashtag
    KNIFE_FALCHION

    Field

    Represents a Falchion Knife.


    hashtag
    KNIFE_SURVIVAL_BOWIE

    Field

    Represents a Bowie Knife.


    hashtag
    KNIFE_BUTTERFLY

    Field

    Represents a Butterfly Knife.


    hashtag
    KNIFE_PUSH

    Field

    Represents a Shadow Daggers.


    hashtag
    KNIFE_CORD

    Field

    Represents a Paracord Knife.


    hashtag
    KNIFE_CANIS

    Field

    Represents a Survival Knife.


    hashtag
    KNIFE_URSUS

    Field

    Represents an Ursus Knife.


    hashtag
    KNIFE_GYPSY_JACKKNIFE

    Field

    Represents a Navaja Knife.


    hashtag
    KNIFE_OUTDOOR

    Field

    Represents a Nomad Knife.


    hashtag
    KNIFE_STILETTO

    Field

    Represents a Stiletto Knife.


    hashtag
    KNIFE_WIDOWMAKER

    Field

    Represents a Talon Knife.


    hashtag
    KNIFE_SKELETON

    Field

    Represents a Skeleton Knife.


    hashtag
    KNIFE_KUKRI

    Field

    Represents a Kukri Knife.

    Vector
    Vector
    Vector
    Vector
    Vector
    Vector
    C_BaseEntity
    C_CSWeaponBaseGun
    C_CSWeaponBaseGun
    Vector
    Vector
    EHitBox
    CHitboxInfo
    EHitBox
    Vector
    Rect

    Type

    Description

    Cursor position.

    Type

    Description

    Previous cursor position.

    Type

    Description

    Cursor delta.

    Type

    Description

    bool

    true if moved.

    Type

    Description

    bool

    true if moved.

    Type

    Description

    bool

    true if processed.

    Type

    Description

    bool

    true if released.

    Type

    Description

    float

    Rows scrolled.

    Name

    Type

    Description

    mb

    Mouse button.

    Type

    Description

    bool

    true if depressed.

    Name

    Type

    Description

    mb

    Mouse button.

    Type

    Description

    bool

    true if pressed.

    Name

    Type

    Description

    mb

    Mouse button.

    Type

    Description

    bool

    true if clicked.

    Name

    Type

    Description

    mb

    Mouse button.

    Type

    Description

    bool

    true if released.

    Type

    Description

    bool

    true if state changed.

    Name

    Type

    Description

    k

    int

    Virtual key.

    Type

    Description

    bool

    true if depressed.

    Name

    Type

    Description

    k

    int

    Virtual key.

    Type

    Description

    bool

    true if pressed.

    Name

    Type

    Description

    k

    int

    Virtual key.

    Type

    Description

    bool

    true if clicked.

    Name

    Type

    Description

    k

    int

    Virtual key.

    Type

    Description

    bool

    true if released.

    local cur = gui.input:Cursor();
    local prev = gui.input:CursorPrev();
    local delta = gui.input:CursorDelta();
    if gui.input:DidCursorMove() then
        -- ...
    end
    if gui.input:DidWheelMove() then
        -- ...
    end
    if gui.input:DidProcessMouse() then
        -- ...
    end
    if gui.input:button_released() then
        -- ...
    end
    local scroll = gui.input:WheelDelta();
    if gui.input:IsMouseUp(gui.MouseButton.LEFT) then
        -- ...
    end
    if gui.input:IsMouseDown(gui.MouseButton.LEFT) then
        -- ...
    end
    if gui.input:IsMouseClicked(gui.MouseButton.LEFT) then
        -- ...
    end
    if gui.input:IsMouseReleased(gui.MouseButton.LEFT) then
        -- ...
    end
    if gui.input:DidProcessKey() then
        -- ...
    end
    if gui.input:IsKeyUp(0x41) then -- 0x41 = "A"
        -- ...
    end
    if gui.input:IsKeyDown(0x41) then -- 0x41 = "A"
        -- ...
    end
    if gui.input:IsKeyClicked(0x41) then -- 0x41 = "A"
        -- ...
    end
    if gui.input:IsKeyReleased(0x41) then -- 0x41 = "A"
        -- ...
    end
    Vec2
    Vec2
    Vec2
    MouseButton
    MouseButton
    MouseButton
    MouseButton

    Rect

    hashtag
    __call

    Constructor

    Creates a new rectangle.

    Arguments

    1. Default rectangle (0, 0 position; 0, 0 size).

    None.

    2. Single value.

    Name
    Type
    Description

    3. Single vector.

    Name
    Type
    Description

    4. Double value.

    Name
    Type
    Description

    5. Double vector.

    Name
    Type
    Description

    6. Four values.

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    mins

    Field

    Type:

    Mins (top-left) vector.


    hashtag
    maxs

    Field

    Type:

    Maxs (bottom-right) vector.


    hashtag
    Width

    Method

    Either returns rectangle's width, or sets a new width.

    Arguments

    1. Get width.

    None.

    2. Set width.

    Name
    Type
    Description

    Returns

    1. Get width.

    Type
    Description

    2. Set width.

    Type
    Description

    Example


    hashtag
    Height

    Method

    Either returns rectangle's height, or sets a new height.

    Arguments

    1. Get height.

    None.

    2. Set height.

    Name
    Type
    Description

    Returns

    1. Get height.

    Type
    Description

    2. Set height.

    Type
    Description

    Example


    hashtag
    Size

    Method

    Either returns rectangle's size, or sets a new size.

    Arguments

    1. Get size.

    None.

    2. Set size.

    Name
    Type
    Description

    Returns

    1. Get size.

    Type
    Description

    2. Set size.

    Type
    Description

    Example


    hashtag
    Explode

    Method

    Explodes the rectangle by given vector (increase size from center into all directions by coordinates in the vector).

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    HalfWidth

    Method

    Returns a rectangle with half of the width of this rectangle.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    Translate

    Method

    Translates (moves) this rectangle by vector coordinates.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    MarginLeft

    Method

    Move rectangle from the left by given amount.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    MarginRight

    Method

    Move rectangle from the right by given amount.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    MarginTop

    Method

    Move rectangle from the top by given amount.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    MarginBottom

    Method

    Move rectangle from the bottom by given amount.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    PaddingLeft

    Method

    Adds the value to the left side of the rectangle.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    PaddingRight

    Method

    Adds the value to the right side of the rectangle.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    PaddingTop

    Method

    Adds the value to the top side of the rectangle.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    PaddingBottom

    Method

    Adds the value to the bottom side of the rectangle.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    Shrink

    Method

    Shrinks (implodes) the rectangle by given amount.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    Expand

    Method

    Expands (explodes) the rectangle by given amount.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    Contains

    Method

    Returns true if this rectangle contains either vector or another rectangle.

    circle-info

    Rectangle overload will return true ONLY of entire other rectangle is within the bounds of this one.

    Arguments

    1. Vector variant.

    Name
    Type
    Description

    2. Rectangle variant.

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    Overlaps

    Method

    Returns true if the other rectangle overlaps with this rectangle.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    Intersect

    Method

    Intersects this rectangle with another rectangle.

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    TL

    Method

    Returns top-left vector.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    TR

    Method

    Returns top-right vector.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    BR

    Method

    Returns bottom-right vector.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    BL

    Method

    Returns bottom-left vector.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    Center

    Method

    Returns center point of this rectangle.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    Circle

    Method

    Treats this rectangle as an ellipsis and returns point on it. Note, that this "ellipsis" will be perfect with no modified curvature (basically if this rectangle is a box - you will get a point on a perfect circle).

    Arguments

    Name
    Type
    Description

    Returns

    Type
    Description

    Example


    hashtag
    Floor

    Method

    Returns floored rectangle.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    Ceil

    Method

    Returns ceiled rectangle.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    Round

    Method

    Returns rounded rectangle.

    Arguments

    None.

    Returns

    Type
    Description

    Example


    hashtag
    IsZero

    Method

    Returns true if both mins and maxs are equal to 0.

    Arguments

    None.

    Returns

    Type
    Description

    Example

    value

    float

    Mins XY, maxs XY value.

    value

    Vec2

    Mins vector, maxs vector.

    x

    float

    Mins/maxs X coordinate.

    y

    float

    Mins/maxs Y coordinate.

    mins

    Vec2

    Mins vector.

    maxs

    Vec2

    Maxs vector.

    x0

    float

    Mins X coordinate.

    y0

    float

    Mins Y coordinate.

    x1

    float

    Maxs X coordinate.

    y1

    float

    Maxs Y coordinate.

    Rect

    New rectangle.

    value

    float

    New width.

    float

    Width.

    Rect

    New rectangle with changed width.

    value

    float

    New height.

    float

    Height.

    Rect

    New rectangle with changed height.

    value

    Vec2

    New size.

    Vec2

    Size.

    Rect

    New rectangle with changed size.

    value

    Vec2

    Explode size.

    Rect

    Exploded rectangle.

    Rect

    Rectangle with halved width.

    value

    Vec2

    Translation amount.

    Rect

    Translated rectangle.

    value

    float

    Margin amount.

    Rect

    Moved rectangle.

    value

    float

    Margin amount.

    Rect

    Moved rectangle.

    value

    float

    Margin amount.

    Rect

    Moved rectangle.

    value

    float

    Margin amount.

    Rect

    Moved rectangle.

    value

    float

    Padding amount.

    Rect

    Resized rectangle.

    value

    float

    Padding amount.

    Rect

    Resized rectangle.

    value

    float

    Padding amount.

    Rect

    Resized rectangle.

    value

    float

    Padding amount.

    Rect

    Resized rectangle.

    value

    float

    Shrink value.

    Rect

    Resized rectangle.

    value

    float

    Expand value.

    Rect

    Resized rectangle.

    other

    Vec2

    Vector to check against.

    other

    Rect

    Rectangle to check against.

    bool

    true if other object is in bounds of this rectangle.

    other

    Rect

    Rectangle to check against.

    bool

    true if other rectangle overlaps with this rectangle.

    other

    Rect

    Rectangle to intersect with.

    Rect

    Intersected rectangle.

    Vec2

    Top-left vector.

    Vec2

    Top-right vector.

    Vec2

    Bottom-right vector.

    Vec2

    Bottom-left vector.

    Vec2

    Center point.

    r

    float

    Radians value.

    Vec2

    Point on the ellipsis.

    Rect

    Floored rectangle.

    Rect

    Ceiled rectangle.

    Rect

    Rounded rectangle.

    bool

    true if this is a zero rectangle.

    Vec2
    Vec2
    local my_rect = draw.Rect(50, 50, 150, 150);
    local half_width = rect:Width(rect:Width() * 0.5);
    local half_height = rect:Height(rect:Height() * 0.5);
    local half_size = rect:Size(rect:Size() * draw.Vec2(0.5, 0.5));
    local exp = rect:Explode(draw.Vec2(6, 6)); -- will subtract -3,-3 from mins and add 3,3 to maxs
    local half = rect:HalfWidth();
    local rect = draw.Rect(50, 50, 150, 150);
    local translated = rect:Translate(draw.Vec2(5, 5)); -- mins/maxs will be 55,55 and 155,155
    local new = rect:MarginLeft(5); -- moves to the right by 5px
    local new = rect:MarginRight(5); -- moves to the left by 5px
    local new = rect:MarginTop(5); -- moves to the bottom by 5px
    local new = rect:MarginBottom(5); -- moves to the top by 5px
    local new = rect:PaddingLeft(5); -- adds 5 to mins x
    local new = rect:PaddingRight(5); -- adds 5 to maxs x
    local new = rect:PaddingTop(5); -- adds 5 to mins y
    local new = rect:PaddingBottom(5); -- adds 5 to maxs y
    local shrinked = rect:Shrink(5); -- adds 5,5 to mins and subtracts 5,5 from maxs
    local expanded = rect:Expand(5); -- subtracts 5,5 from mins and adds 5,5 to maxs
    if rect:Contains(cursor_pos) then
        -- ...
    end
    if rect:Overlaps(another_rect) then
        -- ...
    end
    local intersected = rect:Intersect(another_rect);
    local tl = rect:TL();
    local tr = rect:TR();
    local br = rect:BR();
    local bl = rect:BL();
    local center = rect:Center();
    local point = rect:Circle(rad(250)); -- returns point on the 250th degree
    local floored = rect:Floor();
    local ceiled = rect:Ceil();
    local rounded = rect:Round();
    if rect:IsZero() then
        -- ...
    end

    Color

    hashtag
    color

    Last modified: 03 January 2025

    This type is a color used within the rendering system.

    circle-exclamation

    Do not mistake this type with that is used in game! While these types are interchangeable internally, they are NOT in the API.

    hashtag
    __call

    Constructor

    Creates a new color instance.

    Arguments

    1. Default color (translucent black).

    None.

    2. Integer colors.

    3. Hex string.

    Returns

    Example


    hashtag
    White

    Function

    Returns a white, opaque color.

    Arguments

    None.

    Returns

    Example


    hashtag
    WhiteTransparent

    Function

    Returns a white, transparent color.

    Arguments

    None.

    Returns

    Example


    hashtag
    Black

    Function

    Returns a black, opaque color.

    Arguments

    None.

    Returns

    Example


    hashtag
    BlackTransparent

    Function

    Returns a black, transparent color.

    Arguments

    None.

    Returns

    Example


    hashtag
    Percent

    Function

    Returns a red-to-green color, depending on the provided percent.

    Arguments

    Returns

    Example


    hashtag
    Gray

    Function

    Returns a black-to-white color, depending on the provided percent.

    Arguments

    Returns

    Example


    hashtag
    Interpolate

    Function

    Interpolates two colors.

    Arguments

    Returns

    Example


    hashtag
    RGBA

    Method

    Returns integer representation of this color (RGBA format)

    Arguments

    None.

    Returns

    Example


    hashtag
    ARGB

    Method

    Returns integer representation of this color (ARGB format)

    Arguments

    None.

    Returns

    Example


    hashtag
    BGRA

    Method

    Returns integer representation of this color (BGRA format)

    Arguments

    None.

    Returns

    Example


    hashtag
    ABGR

    Method

    Returns integer representation of this color (ABGR format)

    Arguments

    None.

    Returns

    Example


    hashtag
    Darken

    Method

    Returns darker variant of this color.

    Arguments

    Returns

    Example


    hashtag
    Lighten

    Method

    Returns saturated version of this color. Opposite of darken.

    Arguments

    Returns

    Example


    hashtag
    ModA

    Method

    Modulate opacity of the color. This will take existing opacity, and multiply it by whatever value you provide. It is useful if you want to modulate same color in steps, instead of setting the accurate opacity number.

    Arguments

    1. Float variant.

    2. Integer variant.

    Returns

    Example


    hashtag
    R

    Method

    Override red and return new color.

    Arguments

    Returns

    Example

    hashtag
    G

    Method

    Override green and return new color.

    Arguments

    Returns

    Example

    hashtag
    B

    Method

    Override blue and return new color.

    Arguments

    Returns

    Example

    hashtag
    A

    Method

    Override opacity and return new color.

    Arguments

    Returns

    Example


    hashtag
    GetR

    Method

    Returns red color value.

    Arguments

    None.

    Returns

    Example


    hashtag
    GetG

    Method

    Returns green color value.

    Arguments

    None.

    Returns

    Example


    hashtag
    GetB

    Method

    Returns blue color value.

    Arguments

    None.

    Returns

    Example


    hashtag
    GetA

    Method

    Returns opacity color value.

    Arguments

    None.

    Returns

    Example


    hashtag
    H

    Method

    Return hue value of the color.

    Arguments

    None.

    Returns

    Example


    hashtag
    S

    Method

    Returns saturation value of the color.

    Arguments

    None.

    Returns

    Example


    hashtag
    V

    Method

    Returns brightness value of the color.

    Arguments

    None.

    Returns

    Example


    hashtag
    HSV

    Method

    Construct new color from provided HSB values.

    Arguments

    Returns

    Example

    Name

    Type

    Description

    r

    int

    Red color (0 to 255).

    g

    int

    Green color (0 to 255).

    b

    int

    Blue color (0 to 255).

    a

    int

    Opacity (0 to 255). Defaults to 255.

    Name

    Type

    Description

    hex

    string

    Hex string. Formats are: #rrggbbaa, #rrggbb, #rgba and #rgb.

    Type

    Description

    Color

    Color object.

    Type

    Description

    Color

    Color object.

    Type

    Description

    Color

    Color object.

    Type

    Description

    Color

    Color object.

    Type

    Description

    Color

    Color object.

    Name

    Type

    Description

    p

    float

    Percentile (0 to 1).

    a

    float

    Opacity. Defaults to 1.

    Type

    Description

    Color

    Color object.

    Name

    Type

    Description

    b

    float

    Percentile (0 to 1).

    a

    float

    Opacity. Defaults to 1.

    Type

    Description

    Color

    Color object.

    Name

    Type

    Description

    a

    Color

    Starting color.

    b

    Color

    Ending color.

    t

    float

    Interpolation percentile.

    Type

    Description

    Color

    Color object.

    Type

    Description

    int

    RGBA color.

    Type

    Description

    int

    ARGB color.

    Type

    Description

    int

    BGRA color.

    Type

    Description

    int

    ABGR color.

    Name

    Type

    Description

    value

    float

    Modulation amount (0 to 1).

    Type

    Description

    Color

    Darker color.

    Name

    Type

    Description

    value

    float

    Modulation amount (0 to 1).

    Type

    Description

    Color

    Saturated color.

    Name

    Type

    Description

    value

    float

    Opacity modulation (0 to 1).

    Name

    Type

    Description

    value

    int

    Opacity modulation (0 to 255).

    Type

    Description

    Color

    Modulated color.

    Name

    Type

    Description

    value

    float

    New value.

    Type

    Description

    Color

    New color.

    Name

    Type

    Description

    value

    float

    New value.

    Type

    Description

    Color

    New color.

    Name

    Type

    Description

    value

    float

    New value.

    Type

    Description

    Color

    New color.

    Name

    Type

    Description

    value

    float

    New value.

    Type

    Description

    Color

    New color.

    Type

    Description

    int

    Color value.

    Type

    Description

    int

    Color value.

    Type

    Description

    int

    Color value.

    Type

    Description

    int

    Color value.

    Type

    Description

    int

    Hue (0 to 359).

    Type

    Description

    float

    Saturation (0 to 1).

    Type

    Description

    float

    Brightness (0 to 1).

    Name

    Type

    Description

    hue

    int

    Hue (0 to 359).

    saturation

    float

    Saturation (0 to 1).

    brightness

    float

    Brightness (0 to 1).

    alpha

    float

    Override opacity of the source color. Must be either left out, or provided 0 to 1 value.

    Type

    Description

    Color

    New color.

    color
    local white = draw.Color(255, 255, 255);
    local white = draw.color.White();
    local white_t = draw.color.WhiteTransparent();
    local black = draw.color.Black();
    local black_t = draw.color.BlackTransparent();
    local yellow = draw.color.Percent(0.5);
    local gray = draw.color.Gray(0.5);
    local a = draw.color.White();
    local b = draw.color.Black();
    local i = draw.color.Interpolate(a, b, 0.5); -- gray
    local num = col:RGBA();
    local num = col:argb();
    local num = col:BGRA();
    local num = col:ABGR();
    local darker = col:Darken(0.5);
    local saturated = col:Lighten(0.5);
    local half_opacity = col:ModA(0.5);
    local full_red = col:R(1);
    local full_green = col:G(1);
    local full_blue = col:B(1);
    local full_opacity = col:A(1);
    local r = col:GetR();
    local g = col:GetG();
    local b = col:GetB();
    local a = col:GetA();
    local hue = col:H();
    local saturation = col:S();
    local brightness = col:V();
    local new_col = col:HSV(250, 0.5, 0.1);

    Layer

    A layer is a type that is used to store render commands, as well as vertex and index data. This is the only way to push shapes and control rendering state.

    hashtag
    g

    FieldRead only

    Type:

    The next render command to be pushed to the queue. This is the object you want to change to, for example, set a texture, or change rendering modes.


    hashtag
    font

    Field

    Type:

    Font to use with add_text. If nothing has been set, no text will get rendered.


    hashtag
    texSz

    Field

    Type:

    Texture dimensions. This value is only required if you are trying to render rounded shapes with a texture, so the rendering system will correctly map your UV coordinates to whatever shape you are rendering.


    hashtag
    skipDpi

    Field

    Type: bool

    If set to true, will skip global DPI scale. Defaults to true.


    hashtag
    AddTriangleFilled

    Method

    Adds a filled triangle with a single color.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddQuadFilled

    Method

    Adds a filled quad with a single color.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddRectFilled

    Method

    Adds a filled rectangle with a single color.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddCircleFilled

    Method

    Adds a filled circle with a single color.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddTriangleFilledMulticolor

    Method

    Adds a filled, multicolor triangle.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddRectFilledMulticolor

    Method

    Adds a filled, multicolor rectangle.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddCircleFilledMulticolor

    Method

    Adds a filled, multicolor circle.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddQuadFilledMulticolor

    Method

    Adds a filled, multicolor quad.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddPillMulticolor

    Method

    Adds a multicolor pill shape.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddShadowLine

    Method

    Adds a shadow line.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddShadowRect

    Method

    Adds a shadowed rectangle.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddGlow

    Method

    Adds a glow box.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddRectFilledRounded

    Method

    Adds a filled, rounded rectangle.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddRectFilledRoundedMulticolor

    Method

    Adds a filled, multicolor rounded rectangle.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddTriangle

    Method

    Adds a stroked triangle.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddQuad

    Method

    Adds a stroked quad.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddRect

    Method

    Adds a stroked rectangle.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddCircle

    Method

    Adds a stroked circle.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddLine

    Method

    Adds a line.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddLineMulticolor

    Method

    Adds a multicolor line.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddRectRounded

    Method

    Adds a rounded, filled rectangle.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddText

    Method

    Adds text.

    circle-info

    If font wasn't set, this function will do nothing.

    circle-info

    You can control the color while rendering the text. To change the color, add \fRRGGBBAA to the string. To reset the color, add \b.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    OverrideClipRect

    Method

    Overrides clip rectangle with support of intersection.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddWithBlur

    Method

    Renders a section with blur applied to it.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddWithBlurShared

    Method

    Renders a section with blur applied to it. Uses a shared texture.

    circle-info

    This method is preferred over AddWithBlur as it performs better.

    Arguments

    Returns

    Nothing.

    Example


    hashtag
    AddWithFrost

    Method

    Renders a section with a frosted effect to it, like in the Xmas theme.

    Arguments

    Returns

    Nothing.

    Example

    Shape color.

    float

    Fill amount (clockwise, 0 to 1). Defaults to 1.

    float

    The portion of the circle to fill, where 1.0 is a full circle. Defaults to 1.0.

    table[, ]

    Colors for the gradient, applied from bottom to top.

    table[, ]

    Colors for the gradient, applied from bottom to top.

    segments

    int

    The number of segments for approximating rounded edges. Defaults to 16.

    float

    Line thickness. Defaults to 1.0.

    mode

    Outline mode. Defaults to INSET.

    Line color.

    thickness

    float

    Line thickness. Defaults to 1.0.

    mode

    Outline mode. Defaults to INSET.

    float

    Fill amount. Defaults to 1.0.

    thickness

    float

    Line thickness. Defaults to 1.0.

    mode

    Outline mode. Defaults to INSET.

    float

    Line thickness. Defaults to 1.0.

    float

    Line thickness. Defaults to 1.0.

    mode

    Outline mode. Defaults to INSET.

    Name

    Type

    Description

    a

    Vec2

    A point.

    b

    Vec2

    B point.

    c

    Vec2

    C point.

    col

    Color

    Shape color.

    Name

    Type

    Description

    tl

    Vec2

    Top left point.

    tr

    Vec2

    Top right point.

    br

    Vec2

    Bottom right point.

    bl

    Vec2

    Bottom left point.

    Name

    Type

    Description

    r

    Rect

    Rectangle.

    col

    Color

    Shape color.

    Name

    Type

    Description

    center

    Vec2

    Center point.

    radius

    float

    Circle radius.

    c

    Color

    Shape color.

    segments

    int

    Circle segments. If set to 0, will attempt automatic segment deduction. Defaults to 0.

    Name

    Type

    Description

    a

    Vec2

    A point.

    b

    Vec2

    B point.

    c

    Vec2

    C point.

    cols

    table[Color, Color, Color]

    Colors for each point. Colors go in the very same order as the parameter list.

    Name

    Type

    Description

    r

    Rect

    Rectangle.

    cols

    table[Color, Color, Color, Color]

    Colors for each corner of the rectangle, in clockwise order starting from top-left.

    Name

    Type

    Description

    center

    Vec2

    Center point.

    radius

    float

    Circle radius.

    cols

    table[Color, Color]

    Colors for the gradient, starting with the inner and ending with the outer color.

    segments

    int

    The number of segments to approximate the circle. Defaults to 36.

    Name

    Type

    Description

    tl

    Vec2

    Top left point.

    tr

    Vec2

    Top right point.

    br

    Vec2

    Bottom right point.

    bl

    Vec2

    Bottom left point.

    Name

    Type

    Description

    mins

    Vec2

    Top left point of the pill.

    maxs

    Vec2

    Bottom right point of the pill.

    radius_min

    float

    The minimum radius of the pill's rounded edges.

    radius_max

    float

    The maximum radius of the pill's rounded edges.

    Name

    Type

    Description

    r

    Rect

    Bounding box for the shadow line.

    dir

    ShadowDir

    Shadow direction.

    a

    float

    Max opacity. Defaults to 0.25.

    Name

    Type

    Description

    r

    Rect

    Rectangle.

    radius

    float

    Shadow distance, in pixels, outwards.

    bg

    bool

    Whether to draw a background for the rectangle. Defaults to true.

    a

    float

    Max opacity of the shadow. Defaults to 0.25.

    Name

    Type

    Description

    r

    Rect

    Box rectangle.

    radius

    float

    Glow distance, in pixels, outwards.

    c

    Color

    Glow color.

    parts

    GlowParts

    Parts of the glow to enable. Defaults to ALL.

    Name

    Type

    Description

    r

    Rect

    Rectangle.

    c

    Color

    Fill color.

    amount

    float

    Rounding amount.

    rnd

    Rounding

    Rounding mode. Defaults to ALL.

    Name

    Type

    Description

    r

    Rect

    Rectangle.

    c

    table[Color, Color, Color, Color]

    Fill colors. Used clockwise, starting from top left.

    amount

    float

    Rounding amount.

    rnd

    Rounding

    Rounding mode. Defaults to ALL.

    Name

    Type

    Description

    a

    Vec2

    Point A.

    b

    Vec2

    Point B.

    c

    Vec2

    Point C.

    col

    Color

    Line color.

    Name

    Type

    Description

    tl

    Vec2

    Top-left point.

    tr

    Vec2

    Top-right point.

    br

    Vec2

    Bottom-right point.

    bl

    Vec2

    Bottom-left point.

    Name

    Type

    Description

    r

    Rect

    Rectangle.

    c

    Color

    Line color.

    thickness

    float

    Line thickness. Defaults to 1.0.

    mode

    OutlineMode

    Outline mode. Defaults to INSET.

    Name

    Type

    Description

    center

    Vec2

    Center point.

    radius

    float

    Circle radius.

    c

    Color

    Line color.

    segments

    int

    Circle segments. Defaults to 36.

    Name

    Type

    Description

    a

    Vec2

    Start point.

    b

    Vec2

    End point.

    c

    Color

    Line color.

    thickness

    float

    Line thickness. Defaults to 1.0

    Name

    Type

    Description

    a

    Vec2

    Start point.

    b

    Vec2

    End point.

    c

    Color

    Start color.

    c2

    Color

    End color.

    Name

    Type

    Description

    r

    Rect

    Rectangle.

    c

    Color

    Line color.

    amount

    float

    Rounding amount.

    rnd

    Rounding

    Rounding mode. Defaults to ALL.

    Name

    Type

    Description

    p

    Vec2

    Text origin point.

    text

    string

    Text.

    c

    Color

    Text color.

    params

    TextParams?

    Text aligning parameters. Defaults to nil.

    Name

    Type

    Description

    r

    Rect?

    New clip rect.

    intersect

    bool

    Whether this function should intersect previous rect with the new one. Defaults to true.

    Name

    Type

    Description

    area

    Rect

    Blurred area

    callback

    function

    Render callback, applies the effect on all render calls inside it

    Name

    Type

    Description

    area

    Rect

    Blurred area

    callback

    function

    Render callback, applies the effect on all render calls inside it

    Name

    Type

    Description

    area

    Rect

    Blurred area

    callback

    function

    Render callback, applies the effect on all render calls inside it

    Command
    FontBase
    Vec2?

    col

    fill

    fill

    cols

    cols

    thickness

    c

    fill

    thickness

    thickness

    layer:AddTriangleFilled(
        draw.Vec2(50, 50), draw.Vec2(25, 75),
        draw.Vec2(75, 75), draw.Color(255, 255, 255));
    layer:AddQuadFilled(
        draw.Vec2(50, 50), draw.Vec2(100, 60),
        draw.Vec2(100, 100), draw.Vec2(30, 70),
        draw.Color(255, 255, 255));
    layer:AddRectFilled(draw.Rect(50, 50, 150, 150), draw.Color(255, 255, 255));
    layer:AddCircleFilled(draw.Vec2(50, 50), 10, draw.Color(255, 255, 255));
    layer:AddTriangleFilledMulticolor(
         draw.Vec2(50, 50), draw.Vec2(25, 75),
         draw.Vec2(75, 75), {
            draw.Color(255, 0, 0),
            draw.Color(0, 255, 0),
            draw.Color(0, 0, 255)
         });
    layer:AddRectFilledMulticolor(
        draw.Rect(50, 50, 150, 150), {
            draw.Color(255, 0, 0),
            draw.Color(0, 255, 0),
            draw.Color(0, 0, 255),
            draw.Color(255, 255, 0)
        });
    layer:AddCircleFilledMulticolor(
        draw.Vec2(100, 100), 50, {
            draw.Color(255, 0, 0),
            draw.Color(0, 0, 255)
        }, 36, 1.0);
    layer:AddQuadFilledMulticolor(
        draw.Vec2(50, 50), draw.Vec2(150, 50),
        draw.Vec2(150, 150), draw.Vec2(50, 150), {
            draw.Color(255, 0, 0),
            draw.Color(0, 0, 255)
        });
    layer:AddPillMulticolor(
        draw.Vec2(50, 50), draw.Vec2(150, 100),
        10, 20, {
            draw.Color(255, 0, 0),
            draw.Color(0, 0, 255)
        }, 16);
    layer:AddShadowLine(
        draw.Rect(50, 50, 150, 150), draw.ShadowDir.DOWN, 0.25);
    layer:AddShadowRect(
        draw.Rect(50, 50, 150, 150), 15, true, 0.25);
    layer:AddGlow(draw.Rect(50, 50, 150, 150), 15, draw.Color(255, 0, 0));
    layer:AddRectFilledRounded(
        draw.Rect(50, 50, 150, 150),
        draw.Color(255, 0, 0),
        10,
        draw.Rounding.ALL
    );
    layer:AddRectFilledRoundedMulticolor(
        draw.Rect(50, 50, 150, 150), {
            draw.Color(255, 0, 0),
            draw.Color(0, 255, 0),
            draw.Color(0, 0, 255),
            draw.Color(255, 255, 0)
        },
        10,
        draw.Rounding.ALL
    );
    layer:AddTriangle(
        draw.Vec2(50, 50),
        draw.Vec2(25, 75),
        draw.Vec2(75, 75),
        draw.Color(255, 0, 0),
        1.0,
        draw.OutlineMode.INSET
    );
    layer:AddQuad(
        draw.Vec2(50, 50),
        draw.Vec2(150, 50),
        draw.Vec2(150, 150),
        draw.Vec2(50, 150),
        draw.Color(255, 0, 0),
        1.0,
        draw.OutlineMode.INSET
    );
    layer:AddRect(
        draw.Rect(50, 50, 150, 150),
        draw.Color(255, 0, 0),
        1.0,
        draw.OutlineMode.INSET
    );
    layer:AddCircle(
        draw.Vec2(100, 100),
        50,
        draw.Color(255, 0, 0),
        36,
        1.0,
        1.0,
        draw.OutlineMode.INSET
    );
    layer:AddLine(
        draw.Vec2(50, 50),
        draw.Vec2(150, 150),
        draw.Color(255, 0, 0)
    );
    layer:AddLineMulticolor(
        draw.Vec2(50, 50),
        draw.Vec2(150, 150),
        draw.Color(255, 0, 0),
        draw.Color(0, 0, 255),
        2.0
    );
    layer:AddRectRounded(draw.Rect(50, 50, 150, 150),
        draw.Color(255, 255, 255), 14);
    layer:AddText(draw.Vec2(50, 50), 'Hello world!', draw.Color(255, 255, 255));
    layer:OverrideClipRect(draw.Rect(50, 50, 150, 150));
    layer:AddWithBlur(draw.Rect(0, 0, 200, 200), function()
        layer:AddText(draw.Vec2(100, 100), "I'm so blurry!", draw.Color.White())
    end)
    layer:AddWithBlurShared(draw.Rect(0, 0, 200, 200), function()
        layer:AddText(draw.Vec2(100, 100), "I can't read this either...", draw.Color.White())
    end)
    layer:AddWithFrost(draw.Rect(0, 0, 200, 200), function()
        layer:AddText(draw.Vec2(100, 100), "Chilly", draw.Color.White())
    end)
    Color
    Color
    Color
    Color
    Color
    OutlineMode
    Color
    OutlineMode
    OutlineMode
    OutlineMode