RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

UI

BeamNG ImGui API ReferenceBeamNG ImGui Cheat SheetBeamNG ImGui Data TypesBeamNG World Editor ImGui WindowsBeamNG ImGui Flags & ConstantsBeamNG ImGui Patterns & ExamplesBeamNG ImGui Style Guide

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

ImGui

BeamNG ImGui Data Types

ImGui uses C-style pointers for mutable values. BeamNG wraps these as Lua tables with a `[0]` index.

Pointer Types

ImGui uses C-style pointers for mutable values. BeamNG wraps these as Lua tables with a [0] index.

BoolPtr

local checked = im.BoolPtr(false)
if im.Checkbox("Enable", checked) then
  print("Now: " .. tostring(checked[0]))
end
-- Read: checked[0] → true/false
-- Write: checked[0] = true

IntPtr

local count = im.IntPtr(5)
if im.InputInt("Count", count) then
  print("Value: " .. count[0])
end
if im.SliderInt("Slider", count, 0, 100) then end
if im.DragInt("Drag", count) then end

FloatPtr

local speed = im.FloatPtr(1.0)
if im.InputFloat("Speed", speed, 0.1, 1.0, "%.2f") then end
if im.SliderFloat("Slider", speed, 0, 10, "%.1f") then end
if im.DragFloat("Drag", speed, 0.01, 0, 100) then end

DoublePtr

local precise = im.DoublePtr(3.14159)
if im.InputDouble("Value", precise, 0.01, 0.1, "%.5f") then end

ArrayChar (String Buffer)

local ffi = require("ffi")
local buf = im.ArrayChar(256, "default text")

-- InputText: returns true when modified
if im.InputText("Name", buf, 256) then
  local text = ffi.string(buf)
  print("Typed: " .. text)
end

-- InputTextMultiline
local bigBuf = im.ArrayChar(4096, "line1\nline2")
if im.InputTextMultiline("##editor", bigBuf, 4096, im.ImVec2(400, 200)) then end

-- InputText with flags
if im.InputText("Search", buf, 256, im.InputTextFlags_EnterReturnsTrue) then
  -- Only fires on Enter key
end

ArrayFloat / ArrayInt

local floats = im.ArrayFloat(4)  -- [0]=0, [1]=0, [2]=0, [3]=0
local ints = im.ArrayInt(3)

Vector Types

ImVec2

local size = im.ImVec2(200, 100)
local pos = im.ImVec2(0, 0)

-- Access fields
print(size.x, size.y)

-- Common uses
im.SetNextWindowSize(im.ImVec2(400, 300))
im.SetNextWindowPos(im.ImVec2(100, 100))
im.Button("OK", im.ImVec2(120, 0))  -- 0 = auto height
im.Dummy(im.ImVec2(0, 20))  -- spacer

ImVec4

local color = im.ImVec4(1, 0, 0, 1)  -- RGBA, 0-1 range
im.TextColored(color, "Red text")
im.PushStyleColor2(im.Col_Text, im.ImVec4(0.5, 1, 0.5, 1))
-- ... green text widgets ...
im.PopStyleColor()

Color Types

ImVec4 Colors (float RGBA)

-- Most ImGui color functions use ImVec4 (0.0-1.0 range)
im.PushStyleColor2(im.Col_WindowBg, im.ImVec4(0.1, 0.1, 0.1, 0.95))
im.TextColored(im.ImVec4(1, 0.8, 0, 1), "Warning!")

ImColor (helper)

local color = im.ImColor(255, 128, 0, 255)  -- integer RGBA
-- Or use the RGB helper:
local c = im.ImColorByRGB(255, 128, 0, 255)  -- returns ImColor with .Value as ImVec4

ColorF (BeamNG engine type)

-- Used outside ImGui (scene objects, markers, etc.)
local color = ColorF(1, 0, 0, 0.5)
-- Convert to ImGui linear:
local linear = color:asLinear4F()

GetColorU32 (for draw lists)

local drawList = im.GetWindowDrawList()
local colorU32 = im.GetColorU322(im.ImVec4(1, 0, 0, 1))
im.ImDrawList_AddRectFilled(drawList, im.ImVec2(10, 10), im.ImVec2(100, 50), colorU32)

Type Conversion Summary

NeedCreate WithRead WithWrite With
Boolim.BoolPtr(false)ptr[0]ptr[0] = true
Intim.IntPtr(0)ptr[0]ptr[0] = 5
Floatim.FloatPtr(0)ptr[0]ptr[0] = 1.5
Stringim.ArrayChar(256, "")ffi.string(buf)Recreate buffer
Vec2im.ImVec2(x, y).x, .yCreate new
Vec4im.ImVec4(x, y, z, w).x, .y, .z, .wCreate new

BeamNG ImGui Cheat Sheet

local im = ui_imgui

BeamNG World Editor ImGui Windows

Editor extensions live in `lua/ge/extensions/editor/` and use the `editor` API alongside ImGui.

On this page

Pointer TypesBoolPtrIntPtrFloatPtrDoublePtrArrayChar (String Buffer)ArrayFloat / ArrayIntVector TypesImVec2ImVec4Color TypesImVec4 Colors (float RGBA)ImColor (helper)ColorF (BeamNG engine type)GetColorU32 (for draw lists)Type Conversion Summary