BlizLua API Documentation

Getting Started

Installation

  1. Download the BlizLua package
  2. Extract to X-Plane/Resources/plugins/
  3. Create scripts in the Scripts directory
  4. Reload plugins through X-Plane's developer menu

Const

XPLM_KEY_HOLD

XPLM_KEY_DOWN

XPLM_KEY_UP

XPLM_SHIFT_KEY_HOLD

XPLM_SHIFT_KEY_DOWN

XPLM_SHIFT_KEY_UP

XPLM_CONTROLL_KEY_HOLD

XPLM_CONTROLL_KEY_DOWN

XPLM_CONTROLL_KEY_UP

XPLM_ALT_KEY_HOLD

XPLM_ALT_KEY_DOWN

XPLM_ALT_KEY_UP

XPLM_INT

XPLM_FLOAT

XPLM_DOUBLE

XPLM_INT_ARRAY

XPLM_FLOAT_ARRAY

XPLM_STRING

XPLM_CMD_BEGIN

XPLM_CMD_Continue

XPLM_CMD_End

XPLM_KEY_RETURN

XPLM_KEY_ESCAPE

XPLM_KEY_TAB

XPLM_KEY_DELETE

XPLM_KEY_LEFT

XPLM_KEY_RIGHT

XPLM_KEY_UP

XPLM_KEY_DOWN

XPLM_KEY_0

XPLM_KEY_1

XPLM_KEY_2

XPLM_KEY_3

XPLM_KEY_4

XPLM_KEY_5

XPLM_KEY_6

XPLM_KEY_7

XPLM_KEY_8

XPLM_KEY_9

XPLM_KEY_DECIMAL

XPLM_VK_BACK

XPLM_VK_TAB

XPLM_VK_CLEAR

XPLM_VK_RETURN

XPLM_VK_ESCAPE

XPLM_VK_SPACE

XPLM_VK_PRIOR

XPLM_VK_NEXT

XPLM_VK_END

XPLM_VK_HOME

XPLM_VK_LEFT

XPLM_VK_UP

XPLM_VK_RIGHT

XPLM_VK_DOWN

XPLM_VK_SELECT

XPLM_VK_PRINT

XPLM_VK_EXECUTE

XPLM_VK_SNAPSHOT

XPLM_VK_INSERT

XPLM_VK_DELETE

XPLM_VK_HELP

XPLM_VK_0

XPLM_VK_1

XPLM_VK_2

XPLM_VK_3

XPLM_VK_4

XPLM_VK_5

XPLM_VK_6

XPLM_VK_7

XPLM_VK_8

XPLM_VK_9

XPLM_VK_A

XPLM_VK_B

XPLM_VK_C

XPLM_VK_D

XPLM_VK_E

XPLM_VK_F

XPLM_VK_G

XPLM_VK_H

XPLM_VK_I

XPLM_VK_J

XPLM_VK_K

XPLM_VK_L

XPLM_VK_M

XPLM_VK_N

XPLM_VK_O

XPLM_VK_P

XPLM_VK_Q

XPLM_VK_R

XPLM_VK_S

XPLM_VK_T

XPLM_VK_U

XPLM_VK_V

XPLM_VK_W

XPLM_VK_X

XPLM_VK_Y

XPLM_VK_Z

XPLM_VK_NUMPAD0

XPLM_VK_NUMPAD1

XPLM_VK_NUMPAD2

XPLM_VK_NUMPAD3

XPLM_VK_NUMPAD4

XPLM_VK_NUMPAD5

XPLM_VK_NUMPAD6

XPLM_VK_NUMPAD7

XPLM_VK_NUMPAD8

XPLM_VK_NUMPAD9

XPLM_VK_MULTIPLY

XPLM_VK_ADD

XPLM_VK_SEPARATOR

XPLM_VK_SUBTRACT

XPLM_VK_DECIMAL

XPLM_VK_DIVIDE

XPLM_VK_F1

XPLM_VK_F2

XPLM_VK_F3

XPLM_VK_F4

XPLM_VK_F5

XPLM_VK_F6

XPLM_VK_F7

XPLM_VK_F8

XPLM_VK_F9

XPLM_VK_F10

XPLM_VK_F11

XPLM_VK_F12

XPLM_VK_EQUAL

XPLM_VK_MINUS

XPLM_VK_RBRACE

XPLM_VK_LBRACE

XPLM_VK_QUOTE

XPLM_VK_SEMICOLON

XPLM_VK_BACKSLASH

XPLM_VK_COMMA

XPLM_VK_SLASH

XPLM_VK_PERIOD

XPLM_VK_BACKQUOTE

XPLM_VK_ENTER

XPLM_VK_NUMPAD_ENT

XPLM_VK_NUMPAD_EQ

PLUGIN_MENU

AIRCRAFT_MENU

MENU_NOCHECK

MENU_UNCHECKED

MENU_CHECKED

XPLM_PROBEHITTERRAIN

XPLM_PROBEERROR

XPLM_PROBEMISSED

DECORATION_NONE

DECORATION_RECTANGLE

XPLM_PHASE_MODERN3D

XPLM_PHASE_FIRSTCOCKPIT

XPLM_PHASE_PANEL

XPLM_PHASE_GAUGES

XPLM_PHASE_WINDOW

XPLM_PHASE_LASTCOCKPIT

Functions

OnClosing()

Get called when xplane close

function OnClosing() end

PlaneLoaded()

Get called when the plane is loaded

function PlaneLoaded() end

PlaneUnloaded()

Get called when the plane is unloaded

function PlaneUnloaded() end

PlaneCrashed()

Get called when the plane is crahed

function PlaneCrashed() end

AirportLoaded()

Get called when the airport is loaded

function AirportLoaded() end

SceneryLoaded()

Get called when the scenery is loaded

function SceneryLoaded() end

LiveryLoaded()

Get called when the livery is loaded

function LiveryLoaded() end

EnteredVR()

Get called when enter VR

function EnteredVR() end

ExitingVR()

Get called when the exit VR

function ExitingVR() end

FMODBankLoaded()

Get called when the FMOD bank is loaded

function FMODBankLoaded() end

FMODBankUnloading()

Get called when the FMOD bank is unloaded

function FMODBankUnloading() end

OnKey()

Get called when a key is pressed, return false if you want disable default keys

function OnKey(key, flags, virtual_key, losing_focus) return true end

Debugging

Log(text)

Print a message to the console

Property Type Description
text string The string you want to print
Log("Hello World")

bliz.Log(type, text)

Print a warning or error to the console

Property Type Description
type string Put inside WARNING or ERROR
text string The string you want to print
bliz.Log("WARNING", "Hello World")
bliz.Log("ERROR", "Hello World")
                        

Xplane Default

CreateXPWindow(config)

Create a new X-Plane window

Property Type Description
title string Window title
position table [x, y, width, height]
visible boolean NOT FORCED TO BE USED
local win = bliz.CreateXPWindow({
        title = "Control Panel",
        position = {100, 100, 400, 300},
        visible = true
    })

Draw(left, right, top, bottom)

Draw inside the window, check OpenGL for more

win:Draw(function(left, right, top, bottom) end)

OnMouseClick(x, y, is_down, button)

Gets called when someone clicks the mouse

win:OnMouseClick(function(x, y, is_down, button) end)

OnMouseWheel(x, y, wheel, clicks)

Gets called when someone scrolls the mouse

win:OnMouseWheel(function(x, y, wheel, clicks) end)

OnCursor(x, y)

Return the position of mouse and can be choose the visibilty, to change mouse icon check Utils

win:OnCursor(function(x, y) end)

bliz.RegisterDrawCallback(func, phase, before, refcon)

Create a register call back

Property Type Description
func function The function you want that get called
phase int It's the phase you want
before int Before draw?
refcon any Not needed, let this empty if you don't need this
bliz.RegisterDrawCallback(function() end, XPLM_PHASE_GAUGES, 1)

bliz.RegisterUpdateCallback(func, num)

Create a register call back

Property Type Description
func function The function you want that get called
num int It's the interval for the function
bliz.RegisterUpdateCallback(function() end, -1)

bliz.RegisterUpdateCallback(func)

Delete a registered call back

Property Type Description
func function Put here the name of the function that you registered
bliz.UnregisterUpdateCallback(update)

bliz.SpeakString(text)

Speak a string you want (using xplane default voice)

Property Type Description
text string Text you want to speak
bliz.SpeakString("Hello")

bliz.DrawXpText(id, text, x, y, color)

Draw Xplane Default Text

Property Type Description
id number You get this from the function Draw
text string The text you want
x number The X position you want
y number The Y position you want
color table A table of RBGA: {n,n,n,n}
bliz.DrawXpText(id, "Hello World", 100, 100, {1,1,1,1})

bliz.Find_Dataref(name)

Get a dataref you want

Property Type Description
name string Dataref name
local dataref = bliz.Find_Dataref("sim/cockpit/autopilot/heading_mag")

bliz.GetDtf(dataref)

Get the value of the dataref

Property Type Description
dataref any Put the dataref you got from Find_Dataref
local get_dtr = bliz.GetDtf(dataref)

bliz.SetDtf(dataref, value)

Set a dataref to a value you want

Property Type Description
dataref dataref Put the dataref you got from Find_Dataref
bliz.SetDtf(dtf, 10)

bliz.CreateDataref(name, type, writeable)

Set a dataref to a value you want

Property Type Description
name string Put here the name of the dataref
type integer Put here the type of the dataref
writeable boolean Put true if you want that it's writeable
bliz.CreateDataref("DC-8/CIVA/n_wpt", XPLM_STRING, true)

bliz.FindCommand(name)

Get a command you want

Property Type Description
name string Dataref name
local command = bliz.FindCommand("sim/flight_controls/door_close_1")

bliz.CreateCommand(command, description)

Create a command

Property Type Description
command any Put the dataref you got from FindCommand
local command = bliz.CreateCommand("Dc-8/CIVA/Button_A", "The button A on the CIVA")

bliz.RegisterCommand(command, before, func)

Register command to a function callback

Property Type Description
command command Put the dataref you got from FindCommand
before integer Should the function get called before or after? (0 = Before; 1 = After)
func function Put here a function
bliz.RegisterCommand(ownCommand, 0, function(cmd, phase, elapsed) end)

bliz.CommandStart(command)

Run a command

Property Type Description
command command Put the dataref you got from FindCommand
bliz.CommandStart(command)

bliz.CommandStop(command)

Stop a command

Property Type Description
command command Put the dataref you got from FindCommand
bliz.CommandStop(command)

bliz.CommandOnce(command)

Run a command Once

Property Type Description
command command Put the dataref you got from FindCommand
bliz.CommandOnce(command)

ImGui

bliz.CreateImGuiWindow(config)

Create a new Imgui window

Property Type Description
title string Window title
position table [x, y, width, height]
decoration int Use the type of the decoraiton
resize_limits table Use the size limits
draw_callback function Tell the function to draw
local win = bliz.CreateImGuiWindow({
    title = "ImGui Commands Test Window",
    position = {100, 100, 600, 500},
    decoration = 1, -- xplm_WindowDecorationRoundRectangle
    resize_limits = {300, 300, 1000, 800},
    draw_callback = function(self)  end
})

self:TextColored(r, g, b, a, text)

Create colored text

Property Type Description
r, g, b, a number Color components (0.0 to 1.0)
text string The text to display
self:TextColored(0.0, 0.8, 0.0, 1.0, "Green Text")

self:TextDisabled(text)

Create disabled/grayed out text

Property Type Description
text string The text to display
self:TextDisabled("Inactive text")

self:TextWrapped(text)

Create text that wraps to fit window width

Property Type Description
text string The text to display (auto-wraps)
self:TextWrapped("Long text that automatically wraps...")

self:BulletText(text)

Create bullet point text

Property Type Description
text string The bullet point text
self:BulletText("List item 1")

self:LabelText(label, text)

Create labeled text (label + value)

Property Type Description
label string The label text
text string The value text
self:LabelText("Status:", "Active")

self:Button(label)

Create a clickable button

Property Type Description
label string Button text
if self:Button("Click Me") then Log("Button clicked!")  end

self:Checkbox(label, value)

Create a checkbox

Property Type Description
label string Checkbox label
value boolean Current state
local changed = self:Checkbox("Enable", isEnabled)
                    if changed then
                        isEnabled = not isEnabled
                    end

self:RadioButton(label, active)

Create a radio button

Property Type Description
label string Radio button label
active boolean Whether this option is selected
if self:RadioButton("Option 1", selected == 1) then
                        selected = 1
                    end

self:ArrowButton(id, direction)

Create an arrow button

Property Type Description
id string Unique identifier
direction integer 0=left, 1=right, 2=up, 3=down
if self:ArrowButton("myArrow", 0) then Log("Left arrow clicked") end

self:Selectable(label, selected)

Create a selectable item

Property Type Description
label string Item label
selected boolean Current selection state
local changed, newState = self:Selectable("Item 1", isSelected)

self:Separator()

Draw a horizontal separator line

self:Separator()

self:InputText(label, value, maxLength)

Create a single-line text input

Property Type Description
label string Input label
value string Current text value
maxLength integer Maximum character length
local changed, newText = self:InputText("Name:", currentName, 50)

self:InputTextMultiline(label, value, maxLength, width, height)

Create a multi-line text input

Property Type Description
label string Input label
value string Current text value
maxLength integer Maximum character length
width number Input field width
height number Input field height
local changed = self:InputTextMultiline("Description:", text, 1024, 300, 100)

self:InputFloat(label, value, step, stepFast, format)

Create a float number input

Property Type Description
label string Input label
value number Current float value
step number Step increment
stepFast number Fast step increment
format string Display format (e.g., "%.2f")
local changed = self:InputFloat("Value:", 1.5, 0.1, 1.0, "%.2f")

self:InputInt(label, value, step, stepFast)

Create an integer number input

Property Type Description
label string Input label
value integer Current integer value
step integer Step increment
stepFast integer Fast step increment
local changed = self:InputInt("Count:", 10, 1, 10)

self:InputDouble(label, value, step, stepFast, format)

Create a double precision number input

Property Type Description
label string Input label
value number Current double value
step number Step increment
stepFast number Fast step increment
format string Display format (e.g., "%.6f")
local changed = self:InputDouble("Precise:", 1.234567, 0.01, 0.1, "%.6f")

self:SliderFloat(label, value, min, max)

Create a float slider

Property Type Description
label string Slider label
value number Current value
min number Minimum value
max number Maximum value
value = self:SliderFloat("Volume:", value, 0.0, 1.0)

self:SliderInt(label, value, min, max)

Create an integer slider

Property Type Description
label string Slider label
value integer Current value
min integer Minimum value
max integer Maximum value
value = self:SliderInt("Size:", value, 0, 100)

self:DragFloat(label, value, speed, min, max, format)

Create a draggable float control

Property Type Description
label string Control label
value number Current value
speed number Drag speed multiplier
min number Minimum value
max number Maximum value
format string Display format
local changed = self:DragFloat("Value:", val, 0.5, 0.0, 100.0, "%.1f")

self:DragInt(label, value, speed, min, max, format)

Create a draggable integer control

Property Type Description
label string Control label
value integer Current value
speed number Drag speed multiplier
min integer Minimum value
max integer Maximum value
format string Display format
local changed = self:DragInt("Count:", val, 1, 0, 100, "%d")

self:DragFloatRange2(label, currentMin, currentMax, speed, min, max, format)

Create a draggable float range control

Property Type Description
label string Control label
currentMin number Current minimum value
currentMax number Current maximum value
speed number Drag speed multiplier
min number Absolute minimum
max number Absolute maximum
format string Display format
local min, max, changed = self:DragFloatRange2("Range:", 0, 100, 0.5, 0, 200, "%.1f")

self:DragIntRange2(label, currentMin, currentMax, speed, min, max, format)

Create a draggable integer range control

Property Type Description
label string Control label
currentMin integer Current minimum value
currentMax integer Current maximum value
speed number Drag speed multiplier
min integer Absolute minimum
max integer Absolute maximum
format string Display format
local min, max, changed = self:DragIntRange2("Range:", 0, 100, 1, 0, 200, "%d")

self:Combo(label, selectedIndex, items)

Create a combo box dropdown

Property Type Description
label string Combo box label
selectedIndex integer Currently selected index (1-based)
items table Array of string options
local changed = self:Combo("Fruit:", 1, {"Apple", "Banana", "Cherry"})

self:ListBox(label, selectedIndex, items)

Create a list box

Property Type Description
label string List box label
selectedIndex integer Currently selected index (1-based)
items table Array of string options
local changed = self:ListBox("Color:", 1, {"Red", "Green", "Blue"})

self:ColorEdit3(label, r, g, b)

Create an RGB color editor

Property Type Description
label string Color picker label
r, g, b number Current RGB values (0.0-1.0)
local r, g, b, changed = self:ColorEdit3("Color:", 1.0, 0.5, 0.0)

self:ColorEdit4(label, r, g, b, a)

Create an RGBA color editor

Property Type Description
label string Color picker label
r, g, b, a number Current RGBA values (0.0-1.0)
local r, g, b, a, changed = self:ColorEdit4("Color:", 1.0, 0.5, 0.0, 1.0)

self:ColorPicker3(label, r, g, b)

Create an RGB color picker

Property Type Description
label string Color picker label
r, g, b number Current RGB values (0.0-1.0)
local r, g, b, changed = self:ColorPicker3("Pick:", 1.0, 0.5, 0.0)

self:SameLine(offsetX)

Place next widget on same line

Property Type Description
offsetX number Optional X offset from previous item
self:Button("A")
                    self:SameLine()
                    self:Button("B")
                    self:SameLine(150)
                    self:Button("C")

self:NewLine()

Move to next line

self:NewLine()

self:BeginGroup()

Start a group of widgets

self:BeginGroup()
                    self:Text("Group Contents")
                    self:Button("Inside Group")
                    self:EndGroup()

self:EndGroup()

End a group of widgets

self:BeginGroup()
                    -- widgets here
                    self:EndGroup()

self:Indent(width)

Increase indentation

Property Type Description
width number Indentation amount in pixels
self:Indent(20)
                    self:Text("Indented text")
                    self:Unindent(20)

self:Unindent(width)

Decrease indentation

Property Type Description
width number Indentation amount in pixels
self:Indent(20)
                    self:Text("Indented")
                    self:Unindent(20)
                    self:Text("Not indented")

self:Dummy(width, height)

Create empty space

Property Type Description
width number Width in pixels
height number Height in pixels
self:Dummy(200, 10)  -- 200px wide, 10px high empty space

self:Spacing()

Add vertical spacing

self:Spacing()

self:SetNextItemWidth(width)

Set width for next widget

Property Type Description
width number Width in pixels
self:SetNextItemWidth(150)
                    self:SliderFloat("Value:", 50, 0, 100)

self:GetCursorPos()

Get current cursor position

local x, y = self:GetCursorPos()

self:SetCursorPos(x, y)

Set cursor position

Property Type Description
x number X position in pixels
y number Y position in pixels
self:SetCursorPos(10, 100)

self:GetWindowWidth()

Get current window width

local width = self:GetWindowWidth()

self:GetWindowHeight()

Get current window height

local height = self:GetWindowHeight()

self:CollapsingHeader(label, defaultOpen)

Create a collapsible header section

Property Type Description
label string Header text
defaultOpen boolean Whether initially open
if self:CollapsingHeader("Options", false) then
                        self:Text("Options content here")
                    end

self:TreeNode(label)

Create a tree node

Property Type Description
label string Node label
if self:TreeNode("Category") then
                        self:Text("Tree content")
                        self:TreePop()
                    end

self:TreePop()

End a tree node

if self:TreeNode("Category") then
                        -- content
                        self:TreePop()
                    end

self:ProgressBar(progress, width, height, overlay)

Create a progress bar

Property Type Description
progress number Progress value (0.0-1.0)
width number Bar width in pixels
height number Bar height in pixels
overlay string Optional overlay text
self:ProgressBar(0.75, 200, 0, "75%")

self:PlotLines(label, values)

Create a line plot

Property Type Description
label string Plot label
values table Array of number values to plot
self:PlotLines("Data", {1, 2, 3, 4, 5})

self:PlotHistogram(label, values)

Create a histogram plot

Property Type Description
label string Plot label
values table Array of number values for histogram
self:PlotHistogram("Distribution", {1, 2, 2, 3, 3, 3, 4, 4, 5})

self:BeginTable(id, columns, width)

Begin a table

Property Type Description
id string Unique table identifier
columns integer Number of columns
width number Table width in pixels
if self:BeginTable("MyTable", 3, 400) then
                        -- table contents
                        self:EndTable()
                    end

self:EndTable()

End a table

self:BeginTable("MyTable", 3, 400)
                    -- content
                    self:EndTable()

self:TableNextRow()

Move to next table row

self:TableNextRow()
                    self:TableNextColumn()
                    self:Text("Cell A1")

self:TableNextColumn()

Move to next table column

self:TableNextRow()
                    self:TableNextColumn(); self:Text("A")
                    self:TableNextColumn(); self:Text("B")
                    self:TableNextColumn(); self:Text("C")

self:BeginMenuBar()

Begin a menu bar

if self:BeginMenuBar() then
                        -- menu items
                        self:EndMenuBar()
                    end

self:EndMenuBar()

End a menu bar

self:BeginMenuBar()
                    -- menus
                    self:EndMenuBar()

self:BeginMenu(label)

Begin a menu

Property Type Description
label string Menu label
if self:BeginMenu("File") then
                        -- menu items
                        self:EndMenu()
                    end

self:EndMenu()

End a menu

self:BeginMenu("File")
                    -- items
                    self:EndMenu()

self:BeginTooltip()

Begin a tooltip

if self:IsItemHovered() then
                        self:BeginTooltip()
                        self:Text("Tooltip content")
                        self:EndTooltip()
                    end

self:EndTooltip()

End a tooltip

self:BeginTooltip()
                    -- tooltip content
                    self:EndTooltip()

self:OpenPopup(id)

Open a popup

Property Type Description
id string Popup identifier
if self:Button("Open") then
                        self:OpenPopup("MyPopup")
                    end

self:BeginPopup(id)

Begin a popup

Property Type Description
id string Popup identifier
if self:BeginPopup("MyPopup") then
                        self:Text("Popup content")
                        self:EndPopup()
                    end

self:EndPopup()

End a popup

self:BeginPopup("MyPopup")
                    -- content
                    self:EndPopup()

self:CloseCurrentPopup()

Close current popup

if self:Button("Close") then
                        self:CloseCurrentPopup()
                    end

self:IsItemHovered()

Check if last item is hovered

if self:Button("Test") then
                        -- clicked
                    end
                    if self:IsItemHovered() then
                        self:SameLine()
                        self:Text("(Hovering)")
                    end

self:IsItemClicked()

Check if last item was clicked

if self:IsItemClicked() then
                        Log("Item was clicked")
                    end

self:IsItemActive()

Check if last item is active (being interacted with)

if self:IsItemActive() then
                        Log("Item is being interacted with")
                    end

self:Columns(count, id, border)

Create multiple columns (legacy layout)

Property Type Description
count integer Number of columns
id string Column group identifier
border boolean Show border between columns
self:Columns(3, "threecols", true)
                    self:Text("Column 1")
                    self:NextColumn()
                    self:Text("Column 2")
                    self:NextColumn()
                    self:Text("Column 3")
                    self:Columns(1)  -- Reset to single column

self:NextColumn()

Move to next column

self:Columns(2)
                    self:Text("Left column")
                    self:NextColumn()
                    self:Text("Right column")

Dataref

bliz.Find_Dataref(name)

Get a dataref you want

Property Type Description
name string Dataref name
local dataref = bliz.Find_Dataref("sim/cockpit/autopilot/heading_mag")

bliz.DrawXpText(dataref)

Get the value of the dataref

Property Type Description
dataref any Put the dataref you got from Find_Dataref
local get_dtr = bliz.Get_Dtf(dataref)

bliz.SetDtf(dataref, value)

Set a dataref to a value you want

Property Type Description
dataref dataref Put the dataref you got from Find_Dataref
bliz.SetDtf(dtf, 10)

bliz.CreateDataref(name, type, writeable)

Set a dataref to a value you want

Property Type Description
name string Put here the name of the dataref
type integer Put here the type of the dataref
writeable boolean Put true if you want that it's writeable
bliz.CreateDataref("DC-8/CIVA/n_wpt", XPLM_STRING, true)

Command

bliz.FindCommand(name)

Get a command you want

Property Type Description
name string Dataref name
local command = bliz.FindCommand("sim/flight_controls/door_close_1")

bliz.CreateCommand(command, description)

Create a command

Property Type Description
command any Put the dataref you got from FindCommand
local command = bliz.CreateCommand("Dc-8/CIVA/Button_A", "The button A on the CIVA")

bliz.RegisterCommand(command, before, func)

Register command to a function callback

Property Type Description
command command Put the dataref you got from FindCommand
before integer Should the function get called before or after? (0 = Before; 1 = After)
func function Put here a function
bliz.RegisterCommand(ownCommand, 0, function(cmd, phase, elapsed) end)

bliz.CommandStart(command)

Run a command

Property Type Description
command command Put the dataref you got from FindCommand
bliz.CommandStart(command)

bliz.CommandStop(command)

Stop a command

Property Type Description
command command Put the dataref you got from FindCommand
bliz.CommandStop(command)

bliz.CommandOnce(command)

Run a command Once

Property Type Description
command command Put the dataref you got from FindCommand
bliz.CommandOnce(command)

Files

bliz.file.SystemPath()

Get the Xplane path

local Xplane_Path = bliz.file.SystemPath()

bliz.file.GetPluginPath()

Get project path

local Porject_Path = bliz.file.SystemPath()

bliz.file.IsFileExists(path)

Check if file exists

Property Type Description
path string The path you want, also need to add the file name
local exists = bliz.file.IsFileExists(GetPluginPath() .. "data/scripts/modules/mouse.png")

bliz.file.DecodeJSON(json)

Convert a json format to lua table

Property Type Description
json string Put here files jsons or a link to json file
local metar = bliz.file.DecodeJSON("https://api.vatsim.net/api/divisions/")

bliz.file.EncodeJSON(table)

Convert a lua table to a json format

Property Type Description
table table The table you want to convert
local json = bliz.file.EncodeJSON(message)

bliz.file.CreateJSON(path)

Get project path

Property Type Description
path string The path you want, also need to add the file name
local success, error = bliz.file.CreateJSON(GetPluginPath() .. "data/scripts/modules/test.json")

bliz.file.ReadJSON(path)

Get project path

Property Type Description
path string The path you want, also need to add the file name
local readSuccess, readErr = ReadJSON(GetPluginPath() .. "data/scripts/modules/test.json")

bliz.file.WriteJSON(path, data)

Get project path

Property Type Description
path string The path you want, also need to add the file name
data table A table of the data you want insert inside the json
local writeSuccess, writeErr = WriteJSON(GetPluginPath() .. "data/scripts/modules/test.json", testTable)

bliz.file.CreateINI(path)

Get project path

Property Type Description
path string The path you want, also need to add the file name
local success, error = bliz.file.CreateINI(GetPluginPath() .. "data/scripts/modules/test.ini")

bliz.file.WriteINI(path, table)

Get project path

Property Type Description
path string The path you want, also need to add the file name
path string The path you want, also need to add the file name
local writeSuccess, writeErr = WriteINI(GetPluginPath() .. "data/scripts/modules/test.ini", newINI)

bliz.file.ReadINI(path)

Get project path

Property Type Description
path string The path you want, also need to add the file name
local iniData = ReadINI(GetPluginPath() .. "data/scripts/modules/test.ini")

bliz.file.CreateTXT(path)

Get project path

Property Type Description
path string The path you want, also need to add the file name
local success, error = bliz.file.CreateTXT(GetPluginPath() .. "data/scripts/modules/test.txt")

bliz.file.OpenFile(path)

Get project path

Property Type Description
path string The path you want, also need to add the file name
local txtData = bliz.file.OpenFile(GetPluginPath() .. "data/scripts/modules/test.txt")

OpenGL

bliz.gl.BeginClip(x, y, width, height)

Draw custom text

Property Type Description
x number The X position you want
y number The Y position you want
width number The width
height number The Height
bliz.gl.BeginClip(100, 100, 50, 50)

bliz.gl.EndClip()

Draw custom text

Property Type Description
bliz.gl.EndClip()

bliz.gl.DrawCustomText(text, x, y, size, align, color, id_font)

Draw custom text

Property Type Description
text string The text you want
x number The X position you want
y number The Y position you want
size number The size of the text
align number Choose betwen
color table A table of RBGA: {n,n,n,n}
bliz.DrawXpText("Hello World", 100, 100, {1,1,1,1})

bliz.gl.DrawRectangle(x, y, width, heigh, color)

Draw a rectangle

Property Type Description
x number The X position you want
y number The Y position you want
width number The width of the rectangle
height number The height of the rectangle
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawRectangle(150, 50, 50, 50, {1,1,1,1})

bliz.gl.DrawCustomQuad(x1, y1, x2, y2, x3, y3, x4, y4, color)

Draw a custom rectangle

Property Type Description
x1 number The X1 position you want
y1 number The Y1 position you want
x2 number The X2 position you want
y2 number The Y2 position you want
x3 number The X3 position you want
y3 number The Y3 position you want
x4 number The X4 position you want
y4 number The Y4 position you want
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawCustomQuad(150, 200, 40, 120, 30, 10, 40, 60, {1,1,1,1})

bliz.gl.DrawLine(x1, y1, x2, y2, lineWidth, color)

Draw a line

Property Type Description
x1 number The X1 position you want
y1 number The Y1 position you want
x2 number The X2 position you want
y2 number The Y2 position you want
lineWidth number The width of line you want
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawLine(10, 50, 50, 100, 10, {1,1,1,1})

bliz.gl.DrawWideLine(x1, y1, x2, y2, lineWidth, segments, color)

Draw a wide line

Property Type Description
x1 number The X1 position you want
y1 number The Y1 position you want
x2 number The X2 position you want
y2 number The Y2 position you want
lineWidth number The width of line you want
segments number The segments you want
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawWideLine(5, 5, 55, 55, 2, 1, {1,1,1,1})

bliz.gl.DrawLinePattern(x1, y1, x2, y2, lineWidth, color)

Draw a line Pattern

Property Type Description
x1 number The X1 position you want
y1 number The Y1 position you want
x2 number The X2 position you want
y2 number The Y2 position you want
lineWidth number The width of line you want
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawLinePattern(5, 5, 55, 55, 2, 1, {1,1,1,1})

bliz.gl.DrawBezierLineQ(x1, y1, x2, y2, lineWidth, color)

Draw a Bezier Q line

Property Type Description
x1 number The X1 position you want
y1 number The Y1 position you want
x2 number The X2 position you want
y2 number The Y2 position you want
lineWidth number The width of line you want
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawBezierLineQ(5, 5, 55, 55, 2, 1, {1,1,1,1})

bliz.gl.DrawBezierLineC(x1, y1, x2, y2, lineWidth, color)

Draw a Bezier C line

Property Type Description
x1 number The X1 position you want
y1 number The Y1 position you want
x2 number The X2 position you want
y2 number The Y2 position you want
lineWidth number The width of line you want
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawBezierLineC(5, 5, 55, 55, 2, 1, {1,1,1,1})

bliz.gl.DrawArc(x1, y1, x2, y2, lineWidth, color)

Draw a line Pattern

Property Type Description
x1 number The X1 position you want
y1 number The Y1 position you want
x2 number The X2 position you want
y2 number The Y2 position you want
lineWidth number The width of line you want
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawArc(x1, y1, x2, y2, lineWidth, color)

bliz.gl.DrawEllipse(x, y, rx, ry, segments, filled, lineWidth, color)

Draw a line Pattern

Property Type Description
x number The X position you want
y number The Y position you want
rx number The radius X position you want
ry number The radius Y position you want
segments number The segments of line you want
filled boolean Filled?
lineWidth number The width of line you want
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawEllipse(x, y, rx, ry, segments, filled, lineWidth, color)

bliz.gl.DrawFilledCircle(x, y, radius, segments, color)

Draw a a filled circle

Property Type Description
x number The X position you want
y number The Y position you want
radius number How big you want the circle to be
segments number How many segments you want it have
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawFilledCircle(50, 50, 4, 360, {1,1,1,1})

bliz.gl.DrawCircle(x, y, radius, segments, color)

Draw a outline circle

Property Type Description
x number The X position you want
y number The Y position you want
radius number How big you want the circle to be
segments number How many segments you want it have
color table A table of RBGA: {n,n,n,n}
bliz.gl.DrawCircle(100, 100, 50, 360, 5, {1,1,1,1})

bliz.gl.DrawTexture(x, y, width, height, texID)

Draw a texture

Property Type Description
x number The X position you want
y number The Y position you want
width number The width of the texture
height number The high of the texture
texID table You get the id from LoadTexture
bliz.gl.DrawTexture(50, 150, 100, 100, textureID)

bliz.gl.DrawRotatedTexture(x, y, width, height, deg, anchorX, anchorY, texID)

Draw a texture

Property Type Description
x number The X position you want
y number The Y position you want
width number The width of the texture
height number The high of the texture
deg number How many deg should rotate the image
anchorX number Anchor the point where it should rotate in X
anchorY number Anchor the point where it should rotate in Y
texID table You get the id from LoadTexture
bliz.gl.DrawRotatedTexture(50, 150, 100, 100, 90, 50, 50, textureID)

bliz.gl.LoadTexture(path)

Load a texture

Property Type Description
path string The path to the string
local textureID = bliz.gl.LoadTexture(GetPluginPath() .. "data/resources/images/test.png")

bliz.gl.LoadTextureRegion(path, x, y, regionW, regionH)

Load a texture

Property Type Description
path string The path to the string
x number The x position of the region
y number The y position of the region
regionW number The width of the region
regionH number The height of the region
local textureID = bliz.gl.LoadTextureRegion(GetPluginPath() .. "data/resources/images/test.png", 50, 50, 100, 100)

bliz.gl.LoadFont(path)

Load a font

Property Type Description
path string The path to the string
local font = bliz.gl.LoadFont(bliz.font["ARIAL"])

bliz.gl.EnableFog(start, ending, color)

Enable OpenGL fog with specified start, end distances, and optional RGBA color.

Property Type Description
start integer Fog start distance
ending integer Fog end distance
color table Optional RGBA color table {r,g,b,a}
bliz.gl.EnableFog(start, ending, color)

bliz.gl.DisableFog()

Disable OpenGL fog.

bliz.gl.DisableFog()

bliz.gl.EnableDepth()

Enable depth testing for 3D rendering.

bliz.gl.EnableDepth()

bliz.gl.DisableDepth()

Disable depth testing.

bliz.gl.DisableDepth()

bliz.gl.ClearDepth(clearValue)

Clear the depth buffer with an optional value (0.0–1.0).

PropertyTypeDescription
clearValuenumberOptional depth clear value
bliz.gl.ClearDepth(clearValue)

bliz.gl.SetBlendMode(src, dst)

Enable blending with specified source and destination factors.

PropertyTypeDescription
srcintegerSource blend factor
dstintegerDestination blend factor
bliz.gl.SetBlendMode(src, dst)

bliz.gl.PushMatrix()

Push the current matrix stack.

bliz.gl.PushMatrix()

bliz.gl.PopMatrix()

Pop the top matrix from the stack.

bliz.gl.PopMatrix()

bliz.gl.Translate(x, y, z)

Apply translation to the current matrix.

PropertyTypeDescription
xnumberTranslation in X axis
ynumberTranslation in Y axis
znumberTranslation in Z axis
bliz.gl.Translate(x, y, z)

bliz.gl.Rotate(angle, x, y, z)

Rotate around an axis by an angle in degrees.

PropertyTypeDescription
anglenumberRotation angle in degrees
xnumberX component of rotation axis
ynumberY component of rotation axis
znumberZ component of rotation axis
bliz.gl.Rotate(angle, x, y, z)

bliz.gl.Scale(x, y, z)

Scale the current matrix.

PropertyTypeDescription
xnumberScale factor X
ynumberScale factor Y
znumberScale factor Z
bliz.gl.Scale(x, y, z)

bliz.gl.BeginRenderTarget(x, y, width, height, argHandle)

Begin rendering to a render target texture.

PropertyTypeDescription
xintegerRender target X offset
yintegerRender target Y offset
widthintegerWidth of the target
heightintegerHeight of the target
argHandleintegerOptional handle for existing render target
bliz.gl.BeginRenderTarget(x, y, width, height, argHandle)

bliz.gl.EndRenderTarget()

End rendering to a render target.

bliz.gl.EndRenderTarget()

bliz.gl.GetRenderTexture(id)

Get the OpenGL texture ID for a render target or texture handle.

PropertyTypeDescription
idintegerRender target or texture handle
bliz.gl.GetRenderTexture(id)

bliz.gl.DrawVerticalGradient(x, y, width, height, topColor, bottomColor)

Draw a vertical gradient in a window.

PropertyTypeDescription
xnumberX position
ynumberY position
widthnumberWidth of gradient
heightnumberHeight of gradient
topColortableRGBA color at top
bottomColortableRGBA color at bottom
bliz.gl.DrawVerticalGradient(x, y, width, height, topColor, bottomColor)

bliz.gl.DrawHorizontalGradient(x, y, width, height, leftColor, rightColor)

Draw a horizontal gradient in a window.

PropertyTypeDescription
xnumberX position
ynumberY position
widthnumberWidth of gradient
heightnumberHeight of gradient
leftColortableRGBA color at left
rightColortableRGBA color at right
bliz.gl.DrawHorizontalGradient(x, y, width, height, leftColor, rightColor)

bliz.gl.LoadShader(vertexSrc, fragmentSrc)

Load a GLSL vertex and fragment shader and return a handle.

PropertyTypeDescription
vertexSrcstringVertex shader source code
fragmentSrcstringFragment shader source code
bliz.gl.LoadShader(vertexSrc, fragmentSrc)

bliz.gl.UseShader(handle)

Activate a previously loaded shader program.

PropertyTypeDescription
handleintegerShader handle returned by LoadShader
bliz.gl.UseShader(handle)

bliz.gl.SetShaderUniform(handle, name, value)

Set a uniform variable in a shader program.

PropertyTypeDescription
handleintegerShader handle
namestringUniform variable name
valuenumber|tableValue or RGBA table to set
bliz.gl.SetShaderUniform(handle, name, value)

bliz.gl.EnableCull(mode)

Enable face culling. Optional mode: 0=back, 1=front.

PropertyTypeDescription
modeintegerWhich face to cull (default back)
bliz.gl.EnableCull(mode)

bliz.gl.DisableCull()

Disable face culling.

bliz.gl.DisableCull()

bliz.gl.EnableWireframe()

Enable wireframe rendering.

bliz.gl.EnableWireframe()

bliz.gl.DisableWireframe()

Disable wireframe mode and restore filled polygons.

bliz.gl.DisableWireframe()

OpenAL

bliz.gl.LoadSound(path)

Load the .wav

Property Type Description
path string The path to the audio
local id = bliz.gl.LoadSound(GetPluginPath().."data/scripts/modules/audio.wav")

bliz.gl.Playsound(id)

Play the .wav

Property Type Description
id number The id where you get from LoadSound
local suc = bliz.gl.Playsound(id)

bliz.gl.StopSound(id)

Stop the .wav

Property Type Description
id number The id where you get from LoadSound
local suc = bliz.gl.StopSound(id)

bliz.gl.PauseSound(id)

Pause the .wav

Property Type Description
id number The id where you get from LoadSound
local suc = bliz.gl.PauseSound(id)

bliz.gl.ResumeSound(id)

Resume the .wav

Property Type Description
id number The id where you get from LoadSound
local suc = bliz.gl.ResumeSound(id)

bliz.gl.GetSoundDuration(id)

Get how long the audio is in seconds

Property Type Description
id number The id where you get from LoadSound
local dur = bliz.gl.ResumeSound(id)

bliz.gl.GetPlaybackOffset(id)

Returns the current playback position of the audio in seconds

Property Type Description
id number The id where you get from LoadSound
local dur = bliz.gl.GetPlaybackOffset(id)

bliz.gl.SetPlaybackOffset(id, offset)

Sets the current playback position of the audio to the given time in seconds

Property Type Description
id number The id where you get from LoadSound
offset number The position to jump
local suc = bliz.gl.SetPlaybackOffset(id, 3)

NET

bliz.net.SendHTTPRequest(url, method, headers, body)

Sends an HTTP request and returns the response.

Property Type Description
url string The URL of the request.
method string The HTTP method (GET, POST, etc.).
headers table<string, string> A table of HTTP headers.
body string|nil Optional body content for POST/PUT requests.
 
local url = "https://api.weather.com/metar/EDDM"
local method = "GET"
local headers = { ["Accept"] = "application/json" }
local response, err = bliz.net.SendHTTPRequest(url, method, headers, nil)

if response then
    Log("Response: " .. response)
else
    Log("Error: " .. err)
end

bliz.net.DownloadFileFromURL(url, path)

Download any file from URL

Property Type Description
url string The URL of the request.
path string The path where to put

local success, err = DownloadFileFromURL(
    "https://github.com/DevolperRL/BlizLua/archive/refs/heads/main.zip",
    bliz.file.GetPluginPath() .. "data/scripts/modules/main.zip"
)

Weather

bliz.GetMETARAirport(name)

Get Xplane METAR data for an airport

Property Type Description
name string Name of airport
local metar, success = bliz.GetMETARAirport("EDDM")

bliz.FetchWeatherDataVatsim(airportName)

Get Vatsim weather data for an airport

Property Type Description
airportName string Name of airport
local metar = bliz.FetchWeatherDataVatsim("LIPR")

Cursor

bliz.LoadCursorAtlas(id, path)

Number to uint8

Property Type Description
id number Window ID
path string Path to the cursor image
bliz.LoadCursorAtlas(win.id, GetPluginPath() .. "data/scripts/modules/mouse.png")

bliz.DefineCursor(name, x, y, width, height, cursorPosX, cursorPosY)

Define a cursor, for atlas

Property Type Description
name string The name of the cursor
x string The X position of the cursor in the texture
y string The Y position of the cursor in the texture
width string The width of the cursor in the texture
height string The height of the cursor in the texture
cursorPosX string The X position of the cursor on the screen
cursorPosY string The Y position of the cursor on the screen
bliz.DefineCursor("drag", 64, 0, 32, 32, 10, -25)

bliz.SetActiveCursor(id, name)

Set active the custom cursor

Property Type Description
id number Window ID
name string The name of the cursor
bliz.SetActiveCursor(win.id, "drag")

Convert

bliz.to_uint8(n)

Number to uint8

Property Type Description
n number Number you want to convert
local numStr = bliz.to_uint8(255)

bliz.to_uint16(n)

Number to uint16

Property Type Description
n number Number you want to convert
local numStr = bliz.to_uint16(65535)

bliz.to_uint32(n)

Number to uint32

Property Type Description
n number Number you want to convert
local numStr = bliz.to_uint32(4294967295)

bliz.to_uint64(n)

Number to uint64

Property Type Description
n number Number you want to convert
local numStr = bliz.to_uint64(18446744073709551615)

bliz.to_pointer(data)

Data to a pointer (return memory address)

Property Type Description
data any Anything you want to convert
local ptrStr = bliz.to_pointer("Hello")

bliz.to_hex(n)

Number to hex

Property Type Description
n number Number you want to convert
local ptrStr = bliz.to_hex(12345)

bliz.to_cordination(table)

Number to cordination

Property Type Description
n number Number you want to convert
local ptrStr = bliz.to_cordination({250, 250})

Scenery

bliz.ProbeTerrainXYZ(x, y, z)

Probes terrain at the given coordinates and returns terrain properties.

Property Type Description
x number X coordinate
y number Y coordinate
z number Z coordinate
local result, locationX, locationY, 
locationZ, normalX, normalY, normalZ, 
is_wet, velocityX, velocityY, velocityZ = bliz.ProbeTerrainXYZ(10, 20, 30)

bliz.GetMagneticVariation(lat, lon)

Returns the magnetic variation at the given latitude and longitude.

Property Type Description
lat number Latitude
lon number Longitude
local variation = bliz.GetMagneticVariation(37.7749, -122.4194)

bliz.DegTrueToDegMagnetic(trueHDG)

Converts a true heading to a magnetic heading.

local magnetic = bliz.DegTrueToDegMagnetic(90)

bliz.DegMagneticToDegTrue(magnetic)

Converts a magnetic heading to a true heading.

local trueHDG = bliz.DegMagneticToDegTrue(85)

bliz.LoadObject(path)

Loads an object from the specified path.

Property Type Description
path string Path to the object file
local obj = bliz.LoadObject("Car.obj")

bliz.InstanceObject(obj, dataref)

Creates an instance of an object with optional datarefs.

local instance = bliz.InstanceObject(obj, { "sim/flightmodel/position/latitude" })

bliz.WorldToLocal(lat, lon, alt)

Converts world coordinates to local X, Y, Z coordinates.

local x, y, z = bliz.WorldToLocal(37.7749, -122.4194, 30)

bliz.LocalToWorld(x, y, z)

Converts local coordinates to world latitude, longitude, and altitude.

local lat, lon, alt = bliz.LocalToWorld(10, 20, 30)

bliz.ModelToLocal(u, v, w)

Converts model space coordinates to local coordinates.

local x, y, z = bliz.ModelToLocal(5, 10, 15)

bliz.LocalToModel(x, y, z)

Converts local coordinates to model space.

local u, v, w = bliz.LocalToModel(10, 20, 30)

bliz.LoadObjectAsync(path)

Loads an object asynchronously.

local obj = bliz.LoadObjectAsync("Aircraft.obj")

Camera

bliz.StartCameraControl(func)

Start the camera control

Property Type Description
func function The function
local id = bliz.StartCameraControl(function() end)

bliz.StopCameraControl(id)

Stop the camera control

Property Type Description
id number The ID of the camera
bliz.StopCameraControl(id)

bliz.IsCameraBeingControlled()

Check if the camera is being controlled

local isControlled, duration = bliz.IsCameraBeingControlled()

bliz.ReadCameraPosition(func)

Read the camera position

local x, y, z, pitch, heading, roll, zoom = bliz.ReadCameraPosition()

Math

bliz.math.clamp(val, minVal, maxVal)

Clamps a value between a minimum and maximum.

PropertyTypeDescription
valnumberValue to clamp
minValnumberMinimum value
maxValnumberMaximum value
bliz.math.clamp(val, minVal, maxVal)

bliz.math.lerp(a, b, t)

Linear interpolation between a and b.

PropertyTypeDescription
anumberStart
bnumberEnd
tnumberInterpolation factor
bliz.math.lerp(a, b, t)

bliz.math.inverseLerp(a, b, v)

Inverse lerp: returns how far v is between a and b.

PropertyTypeDescription
anumberStart
bnumberEnd
vnumberValue
bliz.math.inverseLerp(a, b, v)

bliz.math.remap(v, iMin, iMax, oMin, oMax)

Remaps a value from one range to another.

PropertyTypeDescription
vnumberInput value
iMinnumberInput min
iMaxnumberInput max
oMinnumberOutput min
oMaxnumberOutput max
bliz.math.remap(v, iMin, iMax, oMin, oMax)

bliz.math.wrap(v, min, max)

Wraps a value in a circular range.

PropertyTypeDescription
vnumberValue
minnumberMinimum
maxnumberMaximum
bliz.math.wrap(v, min, max)

bliz.math.sign(v)

Returns the sign (-1, 0, 1) of a value.

PropertyTypeDescription
vnumberValue
bliz.math.sign(v)

bliz.math.vec2Length(x, y)

Returns the length of a 2D vector.

PropertyTypeDescription
xnumberX
ynumberY
bliz.math.vec2Length(x, y)

bliz.math.vec3Length(x, y, z)

Returns the length of a 3D vector.

PropertyTypeDescription
xnumberX
ynumberY
znumberZ
bliz.math.vec3Length(x, y, z)

bliz.math.vec2Normalize(x, y)

Normalizes a 2D vector.

PropertyTypeDescription
xnumberX
ynumberY
bliz.math.vec2Normalize(x, y)

bliz.math.vec3Normalize(x, y, z)

Normalizes a 3D vector.

PropertyTypeDescription
xnumberX
ynumberY
znumberZ
bliz.math.vec3Normalize(x, y, z)

bliz.math.vec2Dot(x1, y1, x2, y2)

Dot product of 2D vectors.

PropertyTypeDescription
x1numberX₁
y1numberY₁
x2numberX₂
y2numberY₂
bliz.math.vec2Dot(x1, y1, x2, y2)

bliz.math.vec3Dot(x1, y1, z1, x2, y2, z2)

Dot product of 3D vectors.

PropertyTypeDescription
x1numberX₁
y1numberY₁
z1numberZ₁
x2numberX₂
y2numberY₂
z2numberZ₂
bliz.math.vec3Dot(x1, y1, z1, x2, y2, z2)

bliz.math.vec3Cross(x1, y1, z1, x2, y2, z2)

Cross product of 3D vectors.

PropertyTypeDescription
x1numberX₁
y1numberY₁
z1numberZ₁
x2numberX₂
y2numberY₂
z2numberZ₂
bliz.math.vec3Cross(x1, y1, z1, x2, y2, z2)

bliz.math.vec2Angle(x1, y1, x2, y2)

Returns the angle between two 2D vectors.

PropertyTypeDescription
x1numberX₁
y1numberY₁
x2numberX₂
y2numberY₂
bliz.math.vec2Angle(x1, y1, x2, y2)

bliz.math.vec3Angle(x1, y1, z1, x2, y2, z2)

Angle between two 3D vectors.

PropertyTypeDescription
x1numberX₁
y1numberY₁
z1numberZ₁
x2numberX₂
y2numberY₂
z2numberZ₂
bliz.math.vec3Angle(x1, y1, z1, x2, y2, z2)

bliz.math.vec3Project(x1, y1, z1, x2, y2, z2)

Projects vector (x1,y1,z1) onto (x2,y2,z2).

PropertyTypeDescription
x1numberX₁
y1numberY₁
z1numberZ₁
x2numberX₂
y2numberY₂
z2numberZ₂
bliz.math.vec3Project(x1, y1, z1, x2, y2, z2)

bliz.math.distance2D(x1, y1, x2, y2)

Distance between two points in 2D.

PropertyTypeDescription
x1numberX₁
y1numberY₁
x2numberX₂
y2numberY₂
bliz.math.distance2D(x1, y1, x2, y2)

bliz.math.distance3D(x1, y1, z1, x2, y2, z2)

Distance between two points in 3D.

PropertyTypeDescription
x1numberX₁
y1numberY₁
z1numberZ₁
x2numberX₂
y2numberY₂
z2numberZ₂
bliz.math.distance3D(x1, y1, z1, x2, y2, z2)

bliz.math.midpoint(x1, y1, x2, y2)

Midpoint between two 2D points.

PropertyTypeDescription
x1numberX₁
y1numberY₁
x2numberX₂
y2numberY₂
bliz.math.midpoint(x1, y1, x2, y2)

bliz.math.lineIntersection2D(x1, y1, x2, y2, x3, y3, x4, y4)

Intersection point of two 2D lines.

PropertyTypeDescription
x1numberLine1 X₁
y1numberLine1 Y₁
x2numberLine1 X₂
y2numberLine1 Y₂
x3numberLine2 X₁
y3numberLine2 Y₁
x4numberLine2 X₂
y4numberLine2 Y₂
bliz.math.lineIntersection2D(x1, y1, x2, y2, x3, y3, x4, y4)

bliz.math.pointInTriangle(px, py, ax, ay, bx, by, cx, cy)

Checks if a point lies inside a triangle.

PropertyTypeDescription
pxnumberPoint X
pynumberPoint Y
axnumberTriangle A X
aynumberTriangle A Y
bxnumberTriangle B X
bynumberTriangle B Y
cxnumberTriangle C X
cynumberTriangle C Y
bliz.math.pointInTriangle(px, py, ax, ay, bx, by, cx, cy)

bliz.math.rotatePoint(x, y, originX, originY, angleDeg)

Rotates a point around an origin by given degrees.

PropertyTypeDescription
xnumberX
ynumberY
originXnumberOrigin X
originYnumberOrigin Y
angleDegnumberAngle in degrees
bliz.math.rotatePoint(x, y, originX, originY, angleDeg)

bliz.math.headingToVector(hdg)

Converts a heading angle to a directional 2D vector.

PropertyTypeDescription
hdgnumberHeading degrees
bliz.math.headingToVector(hdg)

bliz.math.vectorToHeading(x, y)

Converts a vector to a heading angle.

PropertyTypeDescription
xnumberX
ynumberY
bliz.math.vectorToHeading(x, y)

bliz.math.normalizeHeading(headingDeg)

Normalizes a heading to 0–359 degrees.

PropertyTypeDescription
headingDegnumberHeading
bliz.math.normalizeHeading(headingDeg)

bliz.math.headingDifference(h1, h2)

Returns the signed heading difference.

PropertyTypeDescription
h1numberHeading 1
h2numberHeading 2
bliz.math.headingDifference(h1, h2)

bliz.math.latLonBearing(lat1, lon1, lat2, lon2)

Returns the initial bearing between two lat/lon points.

PropertyTypeDescription
lat1numberLatitude 1
lon1numberLongitude 1
lat2numberLatitude 2
lon2numberLongitude 2
bliz.math.latLonBearing(lat1, lon1, lat2, lon2)

bliz.math.moveLatLon(lat, lon, bearing, distance)

Moves a lat/lon point by bearing and distance.

PropertyTypeDescription
latnumberLatitude
lonnumberLongitude
bearingnumberBearing
distancenumberDistance
bliz.math.moveLatLon(lat, lon, bearing, distance)

bliz.math.airspeedToMach(V, altitude)

Converts airspeed to Mach number.

PropertyTypeDescription
VnumberAirspeed
altitudenumberAltitude
bliz.math.airspeedToMach(V, altitude)

bliz.math.machToAirspeed(M, altitude)

Converts Mach number to airspeed.

PropertyTypeDescription
MnumberMach
altitudenumberAltitude
bliz.math.machToAirspeed(M, altitude)

bliz.math.feetToMeters(feet)

Converts feet to meters.

PropertyTypeDescription
feetnumberFeet value
bliz.math.feetToMeters(feet)

bliz.math.metersToFeet(meters)

Converts meters to feet.

PropertyTypeDescription
metersnumberMeters value
bliz.math.metersToFeet(meters)

bliz.math.knotsToMps(kn)

Converts knots to meters per second.

PropertyTypeDescription
knnumberKnots
bliz.math.knotsToMps(kn)

bliz.math.mpsToKnots(mps)

Converts meters per second to knots.

PropertyTypeDescription
mpsnumberMeters per second
bliz.math.mpsToKnots(mps)

Utils

bliz.CreateOwnManip(x, y, width, height, mousePath, func)

Creates a custom mouse manipulation zone on the 2D panel. When the user clicks within this region, a callback is triggered.

Parameter Type Description
x number X position of the manipulator on the panel (in panel coordinates).
y number Y position of the manipulator on the panel
width number Width of the clickable region
height number Height of the clickable region
mousePath string Path to the cursor icon
func function Callback function to call when the area is clicked or hovered
bliz.CreateOwnManip(100, 100, 50, 50, GetPluginPath() .. "data/scripts/modules/mouse.png", function(event) end)

bliz.SetClipboardText(clip)

Add text to the clipboard

Property Type Description
clip string The text that should be added to the clipboard
bliz.SetClipboardText("Hello!")

bliz.CreateNotification(title, message, lifetime)

Create a warning message

Property Type Description
title string The title text
message string The message text
lifetime int How long should show the notification before disapear (in seconds)
bliz.CreateNotification("Warnng", "You can see me", 3)

bliz.CreateYesNoWarning(text, funcYes, funcNo)

Create a warning message

Property Type Description
text string The message text
funcYes function This will get called when the user click on yes button
funcNo function This will get called when the user click on no button
bliz.CreateYesNoWarning("Test message", funcYes, funcNo)

bliz.CreateWarning(text)

Create a warning message

Property Type Description
text string The text inside the warning
bliz.CreateWarning("Couldn't load load, contact dev")

bliz.ReloadProject()

Reload project

bliz.ReloadProject()

bliz.GetAircraftICAO()

Reload project

local icao = bliz.GetAircraftICAO()

bliz.GetClipboardText()

Get the current clipboard text

local clippboard = bliz.GetClipboardText()

bliz.MeasureFPS()

Get the simulator FPS

local fps = bliz.MeasureFPS()

bliz.GetMouseLocationGlobal()

Get mouse location on desktop

x, y = GetMouseLocationGlobal()

bliz.define(name, value)

Define a value

Property Type Description
name string Name you want to call the variable
value any Anything you want
bliz.define("PI", math.pi)

bliz.LatLonDistance(lat1, lon1, lat2, lon2)

Define a value

Property Type Description
lat1 & lat2 number The latitude you want to calculate the distance from
lon1 & lon2 number The longitude you want to calculate the distance from
local distance = bliz.LatLonDistance(52.5200, 13.4050, 48.8566, 2.3522)

bliz.ConvertLatLongToUTM(lat, lon)

Define a value

Property Type Description
lat number The latitude you want
lon number The longitude you want
local utm, hemi, easting, northing = bliz.ConvertLatLongToUTM(48.858844, .294351)

bliz.GetXPVersion()

Get current Xplane version

local version = bliz.GetXPVersion()

bliz.Include(name)

Include a script to your project

Property Type Description
name string NOTE: If no path is provided, the program will default to using the "modules" folder!
bliz.Include("PFD")

bliz.SetUsersAircraft(path_acf)

Change the user aircraft

Property Type Description
path_acf string The path + the .acf!
bliz.SetUsersAircraft(bliz.file.SystemPath() .. "Aircraft/Laminar Research/Cessna Citation X/Cessna_CitationX.acf")

bliz.PlaceUserAtAirport(airport_name)

Place the user at a airport

Property Type Description
airport_name string The airport name, like "EDDM"
bliz.PlaceUserAtAirport("EDDM")

bliz.PlaceUserAtLocation(lat, lon, MSL, hdg_true, SPS)

Place a user at a exact place

Property Type Description
lat number The latitude of the place to spawn
lon number The longitud of the place to spawn
MSL number The elevation on Meter Sea Level
hdg_true number The true heading of the plane
SPS number Speed in meter per second
bliz.PlaceUserAtLocation(33.942791, -118.410042, 300.0, 250.0, 0.0)

bliz.size_of(type)

Place a user at a exact place

Property Type Description
type string The value you want the size
local size8 = bliz.size_of(numStr) --NOTE: I get this from to_uint8

bliz.wait(time, func)

How much time to sleep

Property Type Description
time number Time to sleep
func function Call after time
bliz.wait(5, function() ... end)

bliz.createThread(func)

Create a new thread

Property Type Description
func function Call after time
bliz.createThread(function() ... end)

bliz.stopThread(threadID)

Create a new thread

Property Type Description
threadID int The ID of the thread
local suc = bliz.stopThread(threadID)

bliz.pauseThread(threadID, pause)

Create a new thread

Property Type Description
threadID int The ID of the thread
pause bool Set the status of the thread
local suc = bliz.pauseThread(threadID, true)

bliz.isThreadAlive(threadID)

Create a new thread

Property Type Description
threadID int The ID of the thread
local suc = bliz.isThreadAlive(threadID)

bliz.resumeThread(threadID)

Create a new thread

Property Type Description
threadID int The ID of the thread
local suc = bliz.resumeThread(threadID)

Example Projects

Altitude Display

local altitude = bliz.Find_Dataref("sim/cockpit2/gauges/indicators/altitude_ft_pilot")

function Draw(id)
    bliz.DrawXpText(id, "ALT: "..math.floor(altitude.value), 50, 50, {1,1,1,1})
end

bliz.CreateNotification(title, description, time)

Create a notification

Property Type Description
title string The title of the notification
description string The description of the notification
time number The time it should stay befroe it disapear
bliz.CreateNotification("Warning", "Reload the plane!", 5)

Troubleshooting

Common Issues

Scripts Not Loading

  • Verify scripts are in Resources/plugins/BlizLua/Scripts
  • Check for Lua syntax errors
  • Ensure file permissions are correct