Setup: added addons/luagd-extensions again

This commit is contained in:
2026-03-16 23:53:50 +00:00
parent d62d8f6adb
commit de25c0ed83
69 changed files with 84414 additions and 0 deletions

View File

@@ -0,0 +1,195 @@
# Changelog
## [Unreleased](https://github.com/gilzoide/lua-gdextension/compare/0.7.0...HEAD)
## [0.7.0](https://github.com/gilzoide/lua-gdextension/releases/tag/0.7.0)
### Added
- Support for setting up RPC method configurations in `LuaScript`s via a table or Dictionary called `rpc_config`.
Use the new `rpc` global function that mimics GDScript's [@rpc annotation](https://docs.godotengine.org/en/stable/classes/class_%40gdscript.html#class-gdscript-annotation-rpc) for the values.
```lua
MyClass.rpc_config = {
method1 = rpc("authority", "unreliable_ordered", "call_local", 1),
method2 = rpc("any_peer", "reliable", "call_remote"),
}
```
- Support for accessing constants and enums from `VariantType`s, such as `Vector2.ZERO` and `Vector2.Axis`.
- Support for power operator between Variants.
Even if only `int` and `float` support them and most people won't ever use them as `Variant` values, add it for completion.
- [Lua Language Server (LLS)](https://luals.github.io/) definition files + `.luarc.json` configuration file that helps with code completion in IDEs that support it
- `GDCLASS` function that returns a table suitable for defining Godot Classes in LuaScripts.
The only thing special about it is that `pairs` iterates over its keys in order of insertion, so that its properties and methods are shown in order of definition in the Godot Editor.
- Calling `get_method_list` on objects with a `LuaScript` attached now returns methods defined in script
- Support for Android devices with 16KB page sizes
### Fixed
- Increment reference count of returned `LuaState` from `LuaObject.get_lua_state`
- Memory leak when indexing Variants with numbers
- Avoid losing exported properties in scenes/resources when reloading a Lua script fails
### Changed
- Updated godot-cpp to 4.5
## [0.6.1](https://github.com/gilzoide/lua-gdextension/releases/tag/0.6.1)
### Fixed
- Access [autoloaded nodes](https://docs.godotengine.org/en/stable/tutorials/scripting/singletons_autoload.html) when `GODOT_SINGLETONS` library is open
- Access [named classes](https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html#registering-named-classes) when `GODOT_CLASSES` library is open
## [0.6.0](https://github.com/gilzoide/lua-gdextension/releases/tag/0.6.0)
### Added
- Support for constructing typed arrays in Lua using the idiom `Array[some_type]()`
- Support for constructing typed dictionaries in Lua using the idiom `Dictionary[key_type][value_type]()`
- Support for typed arrays, typed dictionaries and classes in exported properties:
```lua
MyScript.exported_node_array = export(Array[Node])
MyScript.exported_int_valued_dict = export(Dictionary[Variant][int])
MyScript.exported_texture_property = export(Texture)
-- or
MyScript.exported_node_array = export({ type = Array[Node] })
MyScript.exported_int_valued_dict = export({ type = Dictionary[Variant][int] })
MyScript.exported_texture_property = export({ type = Texture })
```
- `is_instance_valid` utility function when opening `GODOT_UTILITY_FUNCTIONS` library
- Support for older Linux distros using GLIBC on par with Ubuntu 22.04
- Parser API based on Tree Sitter
+ Adds the `LuaParser`, `LuaAST`, `LuaASTNode` and `LuaASTQuery` classes
### Changed
- `LuaScriptInstance`'s data table is passed as `self` to methods instead of their owner `Object`
+ For this to work, the table now has a metatable to access its owner when necessary
- `LuaScript`s now have a "Import Behavior" property, defaulting to "Automatic"
+ In "Automatic" behavior, Lua code is evaluated only if it looks like a Godot script.
Lua code that looks like a Godot script is one that ends by returning a named variable (`return MyClassVariable`) or a table constructed inline (`return {...}`)
+ In "Always Evaluate" behavior, Lua code will always be evaluated
+ In "Don't Load" behavior, Lua code will not be loaded nor evaluated at all
+ Note that only evaluated scripts can be attached to Godot Objects.
- Variant and `LuaScriptInstance` methods are now converted to Callable, so they can be more easily passed to Godot APIs such as `Signal.connect`
```lua
-- Before this change, we had to manually instantiate Callable
some_signal:connect(Callable(self, "method_name"))
-- Now we can pass the method directly
some_signal:connect(self.method_name)
```
### Fixed
- Fixed cyclic references from `LuaScriptInstance` <-> `LuaState`, avoiding leaks of `LuaScript`s
- Fixed cyclic references from `LuaScriptProperty` <-> `LuaState`, avoiding memory leaks
- Support for built-in Variant types in exported properties when passed directly to `export`:
```lua
MyScript.exported_dictionary = export(Dictionary)
```
- Convert null Object Variants (`<Object#null>`) to `nil` when passing them to Lua
- Convert freed Object Variants (`<Freed Object>`) to `nil` when passing them to Lua
- Fixed `LuaJIT core/library version mismatch` errors in LuaJIT builds
- `LuaScriptResourceFormatLoader::_load` now respects the cache mode, fixing "Another resource is loaded from path 'res://...' (possible cyclic resource inclusion)." errors
- Error messages from Lua code using the wrong stack index
- Crashes when passing Lua primitives to `typeof`, `Variant.is`, `Variant.get_type`, `Variant.booleanize`, `Variant.duplicate`, `Variant.get_type_name`, `Variant.hash`, `Variant.recursive_hash` and `Variant.hash_compare`
- The `addons/lua-gdextension/build/.gdignore` file was added to the distributed build.
This fixes import errors when opening the Godot editor with the LuaJIT build.
## [0.5.0](https://github.com/gilzoide/lua-gdextension/releases/tag/0.5.0)
### Added
- Support for Linux arm64
- `LuaTable.get_metatable` and `LuaTable.set_metatable` methods
- Support for building with LuaJIT
- `LuaState.get_lua_runtime`, `LuaState.get_lua_version_num` and `LuaState.get_lua_version_string` methods
## [0.4.0](https://github.com/gilzoide/lua-gdextension/releases/tag/0.4.0)
### Added
- `LuaCoroutine.completed` and `LuaCoroutine.failed` signals
- `await` function similar to GDScript's, allowing coroutines to yield and resume automatically when a signal is emitted
- Support for Web exports
- Support for Windows arm64
- Support for calling static methods from Godot classes, like `FileAccess.open`
- Custom [Lua 5.4+ warning function](https://www.lua.org/manual/5.4/manual.html#lua_setwarnf) that sends messages to `push_warning`
- `LuaThread` class as a superclass for `LuaCoroutine`.
This new class is used when converting a LuaState's main thread to Variant.
- `LuaState.main_thread` property for getting a Lua state's main thread of execution
- Support for setting hooks to `LuaThread`s, including the main thread
### Changed
- `LuaObject` instances are reused when wrapping the same Lua object, so that `==` and `is_same` can be used properly
- The following methods of LuaScripts run in pooled coroutines, so that `await` can be used in them: regular method calls, setter functions, `_init`, `_notification`
- Godot 4.4 is now the minimum version necessary to use this addon
### Fixed
- Use `xcframework` instead of `dylib` in iOS exports
- Crash when Lua errors, but the error object is not a string
- Crash when reloading the GDExtension
## [0.3.0](https://github.com/gilzoide/lua-gdextension/releases/tag/0.3.0)
### Added
- Editor plugin that registers the Lua REPL tab, where you can try Lua code using an empty `LuaState`
- Support for calling Godot String methods using Lua strings
- Optional support for `res://` and `user://` relative paths in package searchers, `loadfile` and `dofile`.
Open the `GODOT_LOCAL_PATHS` library to activate this behavior.
- `LuaState.LoadMode` enum for specifying the Lua load mode: text, binary or any
- `LuaState.do_buffer` and `LuaState.load_buffer` methods for loading Lua code from possibly binary chunks
- `LuaState.package_path` and `LuaState.package_cpath` properties for accessing the value of Lua's [`package.path`](https://www.lua.org/manual/5.4/manual.html#pdf-package.path) and [`package.cpath`](https://www.lua.org/manual/5.4/manual.html#pdf-package.cpath)
- `LuaState.get_lua_exec_dir` static method to get the executable directory used to replace "!" when setting `package_path` and `package_cpath` properties.
When running in the Godot editor, it returns the globalized version of `res://` path.
Otherwise, it returns the base directory of the executable.
- Advanced project settings for setting the `LuaScriptLanguage` state's `package_path` and `package_cpath` properties
- `LuaState.are_libraries_opened` method for checking if a subset of libraries were already opened
- `LuaState.create_function` method for creating a `LuaFunction` from a `Callable`
- API documentation is now available in the Godot editor
### Changed
- The GDExtension is now marked as reloadable
- Renamed `LuaCoroutine::LuaCoroutineStatus` to `LuaCoroutine::Status`
- `LuaState.load_file` and `LuaState.do_file` now receive the load mode instead of buffer size
- `Callable` values when passed to Lua are wrapped as Lua functions when `GODOT_VARIANT` library is not opened, making it possible to call them in sandboxed environments
- Lua is now compiled as C++
### Removed
- `VariantType::has_static_method` internal method
### Fixed
- Bind `LuaCoroutine::status` property with correct enum type
- Bind `LuaError::status` property as int with correct enum type
- Crash when calling utility functions from Lua
- Compilation for Windows using MSVC
## [0.2.0](https://github.com/gilzoide/lua-gdextension/releases/tag/0.2.0)
### Added
- Lua is now available as a scripting language for Godot objects, so that you can create your games entirely in Lua!
- `LuaObject.get_lua_state` method for getting the `LuaState` of a Lua object
- `LuaTable.clear` method
- `LuaTable.rawget` and `LuaTable.rawset` methods that don't trigger metamethods
- `LuaFunction.to_callable` method to easily turn Lua functions to Callable
- `LuaState.load_string` and `LuaState.load_files` for loading Lua code without executing it
- Support for passing a `LuaTable` as `_ENV` in `LuaState.do_string` and `LuaState.do_file`
- Support for `PackedVector4Array` variant type
- "Bouncing Logo" sample scene
### Changed
- Minimum Godot version supported is now 4.3
- Android target API changed to 21 (Android Lollipop 5.0)
- In Lua, `print` is now bound to Godot's `printt` to match Lua's behavior of adding `\t` between passed arguments
### Removed
- `LuaTable.get_value` and `LuaTable.set_value`, use `LuaTable.get` and `LuaTable.set` instead
### Fixed
- Use `PROPERTY_USAGE_NONE` for `LuaState.globals` and `LuaState.registry`, fixing instance leaks
- Lua stack handling in `LuaTable` and utility function wrapper code, fixing crashes
- `typeof` utility function now returns a `VariantType` instead of a value unusable by Lua
- Lua objects coming from a different `LuaState` are passed as Variants to Lua instead of being unwrapped, fixing crashes
## [0.1.0](https://github.com/gilzoide/lua-gdextension/releases/tag/0.1.0)
### Added
- `LuaState` class for holding a Lua state and interacting with it.
You may create as many instances as you want, each one representing an independent Lua state.
- `LuaCoroutine`, `LuaFunction`, `LuaLightUserdata`, `LuaTable` and `LuaUserdata` classes that wrap instances from a Lua state in Godot.
- `LuaError` class that represents errors from Lua code.
- Support for registering `Variant` type in Lua states, so that any Godot data can be manipulated in Lua.
- Support for registering Godot classes in Lua, so you can create instances and access integer constants.
- Support for adding access to Godot singleton objects in Lua, accessible directly by name.
- Support for registering Godot utility functions in Lua, like `print`, `lerp` and `is_same`.
- Support for adding access to Godot global enums in Lua, like `OK`, `TYPE_STRING` and `SIDE_LEFT`.

View File

@@ -0,0 +1,19 @@
Copyright (C) 2026 Gil Barbosa Reis.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,3 @@
<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M28 13.3333C21.9884 13.3333 16.2231 15.7214 11.9722 19.9722C7.72142 24.2231 5.33333 29.9884 5.33333 36C5.33333 42.0116 7.72142 47.7769 11.9722 52.0278C16.2231 56.2786 21.9884 58.6667 28 58.6667C30.9766 58.6667 33.9241 58.0804 36.6742 56.9413C39.4242 55.8022 41.923 54.1325 44.0278 52.0278C46.1325 49.923 47.8022 47.4242 48.9413 44.6742C50.0804 41.9241 50.6667 38.9766 50.6667 36C50.6667 29.9884 48.2786 24.2231 44.0278 19.9722C39.7769 15.7214 34.0116 13.3333 28 13.3333ZM36 34.6667C34.2319 34.6667 32.5362 33.9643 31.2859 32.714C30.0357 31.4638 29.3333 29.7681 29.3333 28C29.3333 26.2319 30.0357 24.5362 31.2859 23.286C32.5362 22.0357 34.2319 21.3333 36 21.3333C37.7681 21.3333 39.4638 22.0357 40.714 23.286C41.9643 24.5362 42.6667 26.2319 42.6667 28C42.6667 29.7681 41.9643 31.4638 40.714 32.714C39.4638 33.9643 37.7681 34.6667 36 34.6667ZM52 5.33333C50.2319 5.33333 48.5362 6.03571 47.2859 7.28595C46.0357 8.5362 45.3333 10.2319 45.3333 12C45.3333 13.7681 46.0357 15.4638 47.2859 16.714C48.5362 17.9643 50.2319 18.6667 52 18.6667C52.8755 18.6667 53.7424 18.4942 54.5512 18.1592C55.3601 17.8242 56.095 17.3331 56.714 16.714C57.3331 16.095 57.8242 15.3601 58.1592 14.5512C58.4942 13.7424 58.6667 12.8755 58.6667 12C58.6667 10.2319 57.9643 8.5362 56.714 7.28595C55.4638 6.03571 53.7681 5.33333 52 5.33333Z" fill="#E0E0E0"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -0,0 +1,43 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://de52k4kdp6s7y"
path="res://.godot/imported/LuaScript_icon.svg-e936c81a8c0f686739c63104e1bb3341.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/lua-gdextension/LuaScript_icon.svg"
dest_files=["res://.godot/imported/LuaScript_icon.svg-e936c81a8c0f686739c63104e1bb3341.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

View File

@@ -0,0 +1,241 @@
# Lua GDExtension
[![Godot Asset Library page](https://img.shields.io/static/v1?logo=godotengine&label=asset%20library%20%28Lua%205.4%29&color=478CBF&message=0.7.0)](https://godotengine.org/asset-library/asset/2330)
[![Godot Asset Library page](https://img.shields.io/static/v1?logo=godotengine&label=asset%20library%20%28LuaJIT%29&color=478CBF&message=0.7.0)](https://godotengine.org/asset-library/asset/2330)
[![Build and Test workflow](https://github.com/gilzoide/lua-gdextension/actions/workflows/build.yml/badge.svg)](https://github.com/gilzoide/lua-gdextension/actions/workflows/build.yml)
<img src="addons/lua-gdextension/icon.png" alt="Lua GDExtension icon" width="150" height="150"/>
Extension for using the [Lua programming language](https://www.lua.org/) in Godot 4.4+
With this addon, you can program your game or application directly in Lua.
You can also create sandboxed Lua states for external modding/scripting support, as many as necessary.
This plugin is available in the Asset Library as:
- [Lua GDExtension](https://godotengine.org/asset-library/asset/2330) (Lua 5.4 version)
- [Lua GDExtension + LuaJIT](https://godotengine.org/asset-library/asset/4119) (LuaJIT version)
## Features
- Create Godot scripts directly in Lua, making it possible to use Lua as an alternative to GDScript or C#
- Create additional Lua states for external modding/scripting support, as many as necessary
- Manage Lua tables, functions and coroutines directly from GDScript, C# or any other scripting language in Godot
- Select which Lua libraries and Godot APIs will be available per Lua state, making sandboxing easier:
+ Lua libraries are the same as Lua/C, like `base`, `package` and `io` libraries
+ Godot APIs:
+ Create and manipulate Variant values
+ Instantiate objects and access class constants
+ Access singleton objects by name
+ Global utility functions, like Godot's `print_rich`, `lerp` and `is_same`.
Also adds an `await` function that mimics GDScript's `await` keyword (only supported when running in a coroutine).
+ Global enums, like `OK`, `TYPE_STRING` and `SIDE_LEFT`
+ Patch Lua `package.searchers`, `require`, `loadfile` and `dofile` to accept paths relative to `res://` and `user://`
- Editor plugin with Lua REPL for testing out Lua snippets
- Choose between Lua 5.4 or LuaJIT v2.1 runtimes (distributed as separate addons)
+ Note: LuaJIT does not support WebAssebly, so Lua 5.4 is always used in Web platform
## Lua scripting in Godot
This addon registers a [ScriptLanguageExtension](https://docs.godotengine.org/en/stable/classes/class_scriptlanguageextension.html) so that Godot objects can be scripted directly in Lua.
For Lua scripts to be usable in Nodes and Resources, they must return a table with the script metadata containing methods, properties, signals, etc...
```lua
-- This is our script metadata table.
--
-- It stores metadata such as its base class, global class_name, icon,
-- as well as any declared properties, methods and signals
local LuaBouncingLogo = {
-- base class (optional, defaults to RefCounted)
extends = Sprite2D,
-- if true, allow the script to be executed by the editor (optional)
tool = false,
-- global class name (optional)
class_name = "LuaBouncingLogo",
-- Declare properties
linear_velocity = export(100),
initial_angle = export_range(-360, 360, "degrees", float),
-- Declare signals
bounced = signal(),
}
-- Called when the node enters the scene tree for the first time.
function LuaBouncingLogo:_ready()
self.position = self:get_viewport():get_size() / 2
self.movement = Vector2(self.linear_velocity, 0):rotated(deg_to_rad(self.initial_angle))
-- To connect a signal in Lua, you can use the method name just like in GDScript
self.bounced:connect(self._on_bounced)
end
-- Called every frame. 'delta' is the elapsed time since the previous frame.
function LuaBouncingLogo:_process(delta)
local viewport_size = self:get_viewport():get_size()
local viewport_rect = Rect2(Vector2(), viewport_size)
if not viewport_rect:encloses(self.global_transform * self:get_rect()) then
self.movement = self.movement:rotated(deg_to_rad(90))
self.bounced:emit()
end
self.position = self.position + self.movement * delta
end
function LuaBouncingLogo:_on_bounced()
print("Bounced =D")
end
-- Setup method RPC configs by creating the `rpc_config` table
-- Each key is a method name and the value is a `rpc` config like GDScript's `@rpc`
LuaBouncingLogo.rpc_config = {
_on_bounced = rpc("authority", "unreliable_ordered", "call_local", 1),
}
-- Return the metadata table for the script to be usable by Godot objects
return LuaBouncingLogo
```
## Calling Lua from Godot
The following classes are registered in Godot for creating Lua states and interacting with them: `LuaState`, `LuaTable`, `LuaUserdata`, `LuaLightUserdata`, `LuaFunction`, `LuaCoroutine`, `LuaThread`, `LuaDebug` and `LuaError`.
Usage example in GDScript:
```gdscript
# 1. Create a Lua state
var lua = LuaState.new()
# 2. Import Lua and Godot APIs into the state
# Optionally pass which libraries should be opened to the method
lua.open_libraries()
# 3. Run Lua code using `LuaState.do_string` or `LuaState.do_file`
var result = lua.do_string("""
local vector = Vector2(1, 2)
return {
this_is_a_table = true,
vector = vector,
}
""")
# 4. Access results from Lua code directly in Godot
# When errors occur, instances of `LuaError` will be returned
if result is LuaError:
printerr("Error in Lua code: ", result)
else:
print(result) # [LuaTable:0x556069ee50ab]
print(result["this_is_a_table"]) # true
print(result["vector"]) # (1, 2)
print(result["invalid key"]) # <null>
# 5. Access the global _G table via `LuaState.globals` property
assert(lua.globals is LuaTable)
lua.globals["a_godot_callable"] = func(): print("Hello from GDScript!")
lua.do_string("""
a_godot_callable() -- 'Hello from GDScript!'
""")
```
## Calling Godot from Lua
- Instantiate and manipulate Godot objects, just like in GDScript.
```lua
local v = Vector3(1, 2, 3)
print(v.x) -- 1
-- Note: use ":" instead of "." to call methods in Lua
print(v:length()) -- 3.74165749549866
local n = Node:new()
print(n:is_inside_tree()) -- false
n:queue_free()
```
- Typed Arrays and Dictionaries are also supported
```lua
-- Element type: int
local int_array = Array[int]()
-- Element type: Node
local node_array = Array[Node]()
-- Key: int, Value: bool
local int_to_bool_dict = Dictionary[int][bool]()
-- Key: Variant, Value: Node
local node_valued_dict = Dictionary[Variant][Node]()
```
- Call Godot utility functions.
```lua
local d1 = Dictionary()
local d2 = Dictionary()
print(is_same(d1, d2)) -- false
print(is_same(d2, d2)) -- true
print(lerp(5, 10, 0.15)) -- 5.75
```
- Access singleton objects by name.
```lua
assert(OS == Engine:get_singleton("OS"))
```
- Construct Array/Dictionary using Lua tables.
```lua
local array = Array{ "value 0", "value 1" }
-- Godot Arrays are indexed from 0, instead of 1
print(array[0]) -- "value 0"
print(array[1]) -- "value 1"
print(array[2]) -- nil
local dict = Dictionary{ hello = "world" }
print(dict) -- { "hello": "world" }
print(dict["hello"]) -- "world"
print(dict["invalid key"]) -- nil
```
- Iterate over values using `pairs` for types that support it, like Arrays, packed arrays, Dictionaries and some math types.
```lua
local dictionary = Dictionary{ hello = "world", key = "value" }
for key, value in pairs(dictionary) do
print(key .. ": " .. value)
end
```
- Length operator (`#`) as a shortcut for calling the `size()` method in any object that supports it.
```lua
local array = Array{ 1, 2, 3, 4 }
print(#array) -- 4
```
- Runtime type check using the `Variant.is` method.
```lua
local array = Array()
print(Variant.is(array, Array)) -- true
print(Variant.is(array, 'Array')) -- true
-- Also available using the method notation from Variant objects
print(array:is(Array)) -- true
print(array:is(Dictionary)) -- false
print(array:is(RefCounted)) -- false
```
- Making protected calls using `pcall`.
```lua
local v = Vector2(1, 2)
print(v:pcall('length')) -- true 2.2360680103302
print(v:pcall('invalid method')) -- false "Invalid method"
```
## TODO
- [X] Bind Variant types to Lua
- [X] Bind utility functions to Lua
- [X] Bind enums and constants to Lua
- [X] Add support for getting global singletons from Lua
- [X] Add support for getting classes from Lua
- [X] Add optional support for `res://` relative paths in `require`, `loadfile` and `dofile`
- [X] Add support for `await`ing signals
- [X] Submit to Asset Library
- [X] Lua ScriptLanguageExtension
+ [X] Add support for property hints / usage flags (including export)
+ [X] Add support for property getter / setter
+ [X] Add `export_*` functions mimicking GDScript annotations for better UX
+ [X] Add support for setting up method RPC configurations
- [X] Support for building with LuaJIT
- [X] Support WebAssembly platform
- [X] Support Windows arm64 platform
- [X] Support Linux arm64 platform
- [ ] Support Linux arm32 and rv64 platform
- [X] Use framework in iOS (possibly a xcframework supporting the iOS simulator as well)
- [X] Automated unit tests
- [X] Automated build and distribution
- [X] Lua REPL editor plugin
## Other projects for using Lua in Godot 4
- https://github.com/WeaselGames/godot_luaAPI
- https://github.com/perbone/luascript

View File

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>libgodot-cpp.ios.template_debug.universal.a</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>libgodot-cpp.ios.template_debug.universal.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>libgodot-cpp.ios.template_release.universal.a</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>libgodot-cpp.ios.template_release.universal.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>libluagdextension.ios.template_debug.universal.a</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>libluagdextension.ios.template_debug.universal.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AvailableLibraries</key>
<array>
<dict>
<key>BinaryPath</key>
<string>libluagdextension.ios.template_release.universal.a</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>libluagdextension.ios.template_release.universal.a</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
<string>XFWK</string>
<key>XCFrameworkFormatVersion</key>
<string>1.0</string>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cih6ia8rwpfa3"
path="res://.godot/imported/icon.png-a1b6b69ff83c17f55db0a93e5e3a4f5d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://addons/lua-gdextension/icon.png"
dest_files=["res://.godot/imported/icon.png-a1b6b69ff83c17f55db0a93e5e3a4f5d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,542 @@
--- This file was automatically generated by generate_lua_godot_api.py
--- @meta
-----------------------------------------------------------
-- Global Enums
-----------------------------------------------------------
--- @alias Side `SIDE_LEFT` | `SIDE_TOP` | `SIDE_RIGHT` | `SIDE_BOTTOM`
SIDE_LEFT = 0
SIDE_TOP = 1
SIDE_RIGHT = 2
SIDE_BOTTOM = 3
--- @alias Corner `CORNER_TOP_LEFT` | `CORNER_TOP_RIGHT` | `CORNER_BOTTOM_RIGHT` | `CORNER_BOTTOM_LEFT`
CORNER_TOP_LEFT = 0
CORNER_TOP_RIGHT = 1
CORNER_BOTTOM_RIGHT = 2
CORNER_BOTTOM_LEFT = 3
--- @alias Orientation `VERTICAL` | `HORIZONTAL`
VERTICAL = 1
HORIZONTAL = 0
--- @alias ClockDirection `CLOCKWISE` | `COUNTERCLOCKWISE`
CLOCKWISE = 0
COUNTERCLOCKWISE = 1
--- @alias HorizontalAlignment `HORIZONTAL_ALIGNMENT_LEFT` | `HORIZONTAL_ALIGNMENT_CENTER` | `HORIZONTAL_ALIGNMENT_RIGHT` | `HORIZONTAL_ALIGNMENT_FILL`
HORIZONTAL_ALIGNMENT_LEFT = 0
HORIZONTAL_ALIGNMENT_CENTER = 1
HORIZONTAL_ALIGNMENT_RIGHT = 2
HORIZONTAL_ALIGNMENT_FILL = 3
--- @alias VerticalAlignment `VERTICAL_ALIGNMENT_TOP` | `VERTICAL_ALIGNMENT_CENTER` | `VERTICAL_ALIGNMENT_BOTTOM` | `VERTICAL_ALIGNMENT_FILL`
VERTICAL_ALIGNMENT_TOP = 0
VERTICAL_ALIGNMENT_CENTER = 1
VERTICAL_ALIGNMENT_BOTTOM = 2
VERTICAL_ALIGNMENT_FILL = 3
--- @alias InlineAlignment `INLINE_ALIGNMENT_TOP_TO` | `INLINE_ALIGNMENT_CENTER_TO` | `INLINE_ALIGNMENT_BASELINE_TO` | `INLINE_ALIGNMENT_BOTTOM_TO` | `INLINE_ALIGNMENT_TO_TOP` | `INLINE_ALIGNMENT_TO_CENTER` | `INLINE_ALIGNMENT_TO_BASELINE` | `INLINE_ALIGNMENT_TO_BOTTOM` | `INLINE_ALIGNMENT_TOP` | `INLINE_ALIGNMENT_CENTER` | `INLINE_ALIGNMENT_BOTTOM` | `INLINE_ALIGNMENT_IMAGE_MASK` | `INLINE_ALIGNMENT_TEXT_MASK`
INLINE_ALIGNMENT_TOP_TO = 0
INLINE_ALIGNMENT_CENTER_TO = 1
INLINE_ALIGNMENT_BASELINE_TO = 3
INLINE_ALIGNMENT_BOTTOM_TO = 2
INLINE_ALIGNMENT_TO_TOP = 0
INLINE_ALIGNMENT_TO_CENTER = 4
INLINE_ALIGNMENT_TO_BASELINE = 8
INLINE_ALIGNMENT_TO_BOTTOM = 12
INLINE_ALIGNMENT_TOP = 0
INLINE_ALIGNMENT_CENTER = 5
INLINE_ALIGNMENT_BOTTOM = 14
INLINE_ALIGNMENT_IMAGE_MASK = 3
INLINE_ALIGNMENT_TEXT_MASK = 12
--- @alias EulerOrder `EULER_ORDER_XYZ` | `EULER_ORDER_XZY` | `EULER_ORDER_YXZ` | `EULER_ORDER_YZX` | `EULER_ORDER_ZXY` | `EULER_ORDER_ZYX`
EULER_ORDER_XYZ = 0
EULER_ORDER_XZY = 1
EULER_ORDER_YXZ = 2
EULER_ORDER_YZX = 3
EULER_ORDER_ZXY = 4
EULER_ORDER_ZYX = 5
--- @alias Key `KEY_NONE` | `KEY_SPECIAL` | `KEY_ESCAPE` | `KEY_TAB` | `KEY_BACKTAB` | `KEY_BACKSPACE` | `KEY_ENTER` | `KEY_KP_ENTER` | `KEY_INSERT` | `KEY_DELETE` | `KEY_PAUSE` | `KEY_PRINT` | `KEY_SYSREQ` | `KEY_CLEAR` | `KEY_HOME` | `KEY_END` | `KEY_LEFT` | `KEY_UP` | `KEY_RIGHT` | `KEY_DOWN` | `KEY_PAGEUP` | `KEY_PAGEDOWN` | `KEY_SHIFT` | `KEY_CTRL` | `KEY_META` | `KEY_ALT` | `KEY_CAPSLOCK` | `KEY_NUMLOCK` | `KEY_SCROLLLOCK` | `KEY_F1` | `KEY_F2` | `KEY_F3` | `KEY_F4` | `KEY_F5` | `KEY_F6` | `KEY_F7` | `KEY_F8` | `KEY_F9` | `KEY_F10` | `KEY_F11` | `KEY_F12` | `KEY_F13` | `KEY_F14` | `KEY_F15` | `KEY_F16` | `KEY_F17` | `KEY_F18` | `KEY_F19` | `KEY_F20` | `KEY_F21` | `KEY_F22` | `KEY_F23` | `KEY_F24` | `KEY_F25` | `KEY_F26` | `KEY_F27` | `KEY_F28` | `KEY_F29` | `KEY_F30` | `KEY_F31` | `KEY_F32` | `KEY_F33` | `KEY_F34` | `KEY_F35` | `KEY_KP_MULTIPLY` | `KEY_KP_DIVIDE` | `KEY_KP_SUBTRACT` | `KEY_KP_PERIOD` | `KEY_KP_ADD` | `KEY_KP_0` | `KEY_KP_1` | `KEY_KP_2` | `KEY_KP_3` | `KEY_KP_4` | `KEY_KP_5` | `KEY_KP_6` | `KEY_KP_7` | `KEY_KP_8` | `KEY_KP_9` | `KEY_MENU` | `KEY_HYPER` | `KEY_HELP` | `KEY_BACK` | `KEY_FORWARD` | `KEY_STOP` | `KEY_REFRESH` | `KEY_VOLUMEDOWN` | `KEY_VOLUMEMUTE` | `KEY_VOLUMEUP` | `KEY_MEDIAPLAY` | `KEY_MEDIASTOP` | `KEY_MEDIAPREVIOUS` | `KEY_MEDIANEXT` | `KEY_MEDIARECORD` | `KEY_HOMEPAGE` | `KEY_FAVORITES` | `KEY_SEARCH` | `KEY_STANDBY` | `KEY_OPENURL` | `KEY_LAUNCHMAIL` | `KEY_LAUNCHMEDIA` | `KEY_LAUNCH0` | `KEY_LAUNCH1` | `KEY_LAUNCH2` | `KEY_LAUNCH3` | `KEY_LAUNCH4` | `KEY_LAUNCH5` | `KEY_LAUNCH6` | `KEY_LAUNCH7` | `KEY_LAUNCH8` | `KEY_LAUNCH9` | `KEY_LAUNCHA` | `KEY_LAUNCHB` | `KEY_LAUNCHC` | `KEY_LAUNCHD` | `KEY_LAUNCHE` | `KEY_LAUNCHF` | `KEY_GLOBE` | `KEY_KEYBOARD` | `KEY_JIS_EISU` | `KEY_JIS_KANA` | `KEY_UNKNOWN` | `KEY_SPACE` | `KEY_EXCLAM` | `KEY_QUOTEDBL` | `KEY_NUMBERSIGN` | `KEY_DOLLAR` | `KEY_PERCENT` | `KEY_AMPERSAND` | `KEY_APOSTROPHE` | `KEY_PARENLEFT` | `KEY_PARENRIGHT` | `KEY_ASTERISK` | `KEY_PLUS` | `KEY_COMMA` | `KEY_MINUS` | `KEY_PERIOD` | `KEY_SLASH` | `KEY_0` | `KEY_1` | `KEY_2` | `KEY_3` | `KEY_4` | `KEY_5` | `KEY_6` | `KEY_7` | `KEY_8` | `KEY_9` | `KEY_COLON` | `KEY_SEMICOLON` | `KEY_LESS` | `KEY_EQUAL` | `KEY_GREATER` | `KEY_QUESTION` | `KEY_AT` | `KEY_A` | `KEY_B` | `KEY_C` | `KEY_D` | `KEY_E` | `KEY_F` | `KEY_G` | `KEY_H` | `KEY_I` | `KEY_J` | `KEY_K` | `KEY_L` | `KEY_M` | `KEY_N` | `KEY_O` | `KEY_P` | `KEY_Q` | `KEY_R` | `KEY_S` | `KEY_T` | `KEY_U` | `KEY_V` | `KEY_W` | `KEY_X` | `KEY_Y` | `KEY_Z` | `KEY_BRACKETLEFT` | `KEY_BACKSLASH` | `KEY_BRACKETRIGHT` | `KEY_ASCIICIRCUM` | `KEY_UNDERSCORE` | `KEY_QUOTELEFT` | `KEY_BRACELEFT` | `KEY_BAR` | `KEY_BRACERIGHT` | `KEY_ASCIITILDE` | `KEY_YEN` | `KEY_SECTION`
KEY_NONE = 0
KEY_SPECIAL = 4194304
KEY_ESCAPE = 4194305
KEY_TAB = 4194306
KEY_BACKTAB = 4194307
KEY_BACKSPACE = 4194308
KEY_ENTER = 4194309
KEY_KP_ENTER = 4194310
KEY_INSERT = 4194311
KEY_DELETE = 4194312
KEY_PAUSE = 4194313
KEY_PRINT = 4194314
KEY_SYSREQ = 4194315
KEY_CLEAR = 4194316
KEY_HOME = 4194317
KEY_END = 4194318
KEY_LEFT = 4194319
KEY_UP = 4194320
KEY_RIGHT = 4194321
KEY_DOWN = 4194322
KEY_PAGEUP = 4194323
KEY_PAGEDOWN = 4194324
KEY_SHIFT = 4194325
KEY_CTRL = 4194326
KEY_META = 4194327
KEY_ALT = 4194328
KEY_CAPSLOCK = 4194329
KEY_NUMLOCK = 4194330
KEY_SCROLLLOCK = 4194331
KEY_F1 = 4194332
KEY_F2 = 4194333
KEY_F3 = 4194334
KEY_F4 = 4194335
KEY_F5 = 4194336
KEY_F6 = 4194337
KEY_F7 = 4194338
KEY_F8 = 4194339
KEY_F9 = 4194340
KEY_F10 = 4194341
KEY_F11 = 4194342
KEY_F12 = 4194343
KEY_F13 = 4194344
KEY_F14 = 4194345
KEY_F15 = 4194346
KEY_F16 = 4194347
KEY_F17 = 4194348
KEY_F18 = 4194349
KEY_F19 = 4194350
KEY_F20 = 4194351
KEY_F21 = 4194352
KEY_F22 = 4194353
KEY_F23 = 4194354
KEY_F24 = 4194355
KEY_F25 = 4194356
KEY_F26 = 4194357
KEY_F27 = 4194358
KEY_F28 = 4194359
KEY_F29 = 4194360
KEY_F30 = 4194361
KEY_F31 = 4194362
KEY_F32 = 4194363
KEY_F33 = 4194364
KEY_F34 = 4194365
KEY_F35 = 4194366
KEY_KP_MULTIPLY = 4194433
KEY_KP_DIVIDE = 4194434
KEY_KP_SUBTRACT = 4194435
KEY_KP_PERIOD = 4194436
KEY_KP_ADD = 4194437
KEY_KP_0 = 4194438
KEY_KP_1 = 4194439
KEY_KP_2 = 4194440
KEY_KP_3 = 4194441
KEY_KP_4 = 4194442
KEY_KP_5 = 4194443
KEY_KP_6 = 4194444
KEY_KP_7 = 4194445
KEY_KP_8 = 4194446
KEY_KP_9 = 4194447
KEY_MENU = 4194370
KEY_HYPER = 4194371
KEY_HELP = 4194373
KEY_BACK = 4194376
KEY_FORWARD = 4194377
KEY_STOP = 4194378
KEY_REFRESH = 4194379
KEY_VOLUMEDOWN = 4194380
KEY_VOLUMEMUTE = 4194381
KEY_VOLUMEUP = 4194382
KEY_MEDIAPLAY = 4194388
KEY_MEDIASTOP = 4194389
KEY_MEDIAPREVIOUS = 4194390
KEY_MEDIANEXT = 4194391
KEY_MEDIARECORD = 4194392
KEY_HOMEPAGE = 4194393
KEY_FAVORITES = 4194394
KEY_SEARCH = 4194395
KEY_STANDBY = 4194396
KEY_OPENURL = 4194397
KEY_LAUNCHMAIL = 4194398
KEY_LAUNCHMEDIA = 4194399
KEY_LAUNCH0 = 4194400
KEY_LAUNCH1 = 4194401
KEY_LAUNCH2 = 4194402
KEY_LAUNCH3 = 4194403
KEY_LAUNCH4 = 4194404
KEY_LAUNCH5 = 4194405
KEY_LAUNCH6 = 4194406
KEY_LAUNCH7 = 4194407
KEY_LAUNCH8 = 4194408
KEY_LAUNCH9 = 4194409
KEY_LAUNCHA = 4194410
KEY_LAUNCHB = 4194411
KEY_LAUNCHC = 4194412
KEY_LAUNCHD = 4194413
KEY_LAUNCHE = 4194414
KEY_LAUNCHF = 4194415
KEY_GLOBE = 4194416
KEY_KEYBOARD = 4194417
KEY_JIS_EISU = 4194418
KEY_JIS_KANA = 4194419
KEY_UNKNOWN = 8388607
KEY_SPACE = 32
KEY_EXCLAM = 33
KEY_QUOTEDBL = 34
KEY_NUMBERSIGN = 35
KEY_DOLLAR = 36
KEY_PERCENT = 37
KEY_AMPERSAND = 38
KEY_APOSTROPHE = 39
KEY_PARENLEFT = 40
KEY_PARENRIGHT = 41
KEY_ASTERISK = 42
KEY_PLUS = 43
KEY_COMMA = 44
KEY_MINUS = 45
KEY_PERIOD = 46
KEY_SLASH = 47
KEY_0 = 48
KEY_1 = 49
KEY_2 = 50
KEY_3 = 51
KEY_4 = 52
KEY_5 = 53
KEY_6 = 54
KEY_7 = 55
KEY_8 = 56
KEY_9 = 57
KEY_COLON = 58
KEY_SEMICOLON = 59
KEY_LESS = 60
KEY_EQUAL = 61
KEY_GREATER = 62
KEY_QUESTION = 63
KEY_AT = 64
KEY_A = 65
KEY_B = 66
KEY_C = 67
KEY_D = 68
KEY_E = 69
KEY_F = 70
KEY_G = 71
KEY_H = 72
KEY_I = 73
KEY_J = 74
KEY_K = 75
KEY_L = 76
KEY_M = 77
KEY_N = 78
KEY_O = 79
KEY_P = 80
KEY_Q = 81
KEY_R = 82
KEY_S = 83
KEY_T = 84
KEY_U = 85
KEY_V = 86
KEY_W = 87
KEY_X = 88
KEY_Y = 89
KEY_Z = 90
KEY_BRACKETLEFT = 91
KEY_BACKSLASH = 92
KEY_BRACKETRIGHT = 93
KEY_ASCIICIRCUM = 94
KEY_UNDERSCORE = 95
KEY_QUOTELEFT = 96
KEY_BRACELEFT = 123
KEY_BAR = 124
KEY_BRACERIGHT = 125
KEY_ASCIITILDE = 126
KEY_YEN = 165
KEY_SECTION = 167
--- @alias KeyModifierMask `KEY_CODE_MASK` | `KEY_MODIFIER_MASK` | `KEY_MASK_CMD_OR_CTRL` | `KEY_MASK_SHIFT` | `KEY_MASK_ALT` | `KEY_MASK_META` | `KEY_MASK_CTRL` | `KEY_MASK_KPAD` | `KEY_MASK_GROUP_SWITCH`
KEY_CODE_MASK = 8388607
KEY_MODIFIER_MASK = 2130706432
KEY_MASK_CMD_OR_CTRL = 16777216
KEY_MASK_SHIFT = 33554432
KEY_MASK_ALT = 67108864
KEY_MASK_META = 134217728
KEY_MASK_CTRL = 268435456
KEY_MASK_KPAD = 536870912
KEY_MASK_GROUP_SWITCH = 1073741824
--- @alias KeyLocation `KEY_LOCATION_UNSPECIFIED` | `KEY_LOCATION_LEFT` | `KEY_LOCATION_RIGHT`
KEY_LOCATION_UNSPECIFIED = 0
KEY_LOCATION_LEFT = 1
KEY_LOCATION_RIGHT = 2
--- @alias MouseButton `MOUSE_BUTTON_NONE` | `MOUSE_BUTTON_LEFT` | `MOUSE_BUTTON_RIGHT` | `MOUSE_BUTTON_MIDDLE` | `MOUSE_BUTTON_WHEEL_UP` | `MOUSE_BUTTON_WHEEL_DOWN` | `MOUSE_BUTTON_WHEEL_LEFT` | `MOUSE_BUTTON_WHEEL_RIGHT` | `MOUSE_BUTTON_XBUTTON1` | `MOUSE_BUTTON_XBUTTON2`
MOUSE_BUTTON_NONE = 0
MOUSE_BUTTON_LEFT = 1
MOUSE_BUTTON_RIGHT = 2
MOUSE_BUTTON_MIDDLE = 3
MOUSE_BUTTON_WHEEL_UP = 4
MOUSE_BUTTON_WHEEL_DOWN = 5
MOUSE_BUTTON_WHEEL_LEFT = 6
MOUSE_BUTTON_WHEEL_RIGHT = 7
MOUSE_BUTTON_XBUTTON1 = 8
MOUSE_BUTTON_XBUTTON2 = 9
--- @alias MouseButtonMask `MOUSE_BUTTON_MASK_LEFT` | `MOUSE_BUTTON_MASK_RIGHT` | `MOUSE_BUTTON_MASK_MIDDLE` | `MOUSE_BUTTON_MASK_MB_XBUTTON1` | `MOUSE_BUTTON_MASK_MB_XBUTTON2`
MOUSE_BUTTON_MASK_LEFT = 1
MOUSE_BUTTON_MASK_RIGHT = 2
MOUSE_BUTTON_MASK_MIDDLE = 4
MOUSE_BUTTON_MASK_MB_XBUTTON1 = 128
MOUSE_BUTTON_MASK_MB_XBUTTON2 = 256
--- @alias JoyButton `JOY_BUTTON_INVALID` | `JOY_BUTTON_A` | `JOY_BUTTON_B` | `JOY_BUTTON_X` | `JOY_BUTTON_Y` | `JOY_BUTTON_BACK` | `JOY_BUTTON_GUIDE` | `JOY_BUTTON_START` | `JOY_BUTTON_LEFT_STICK` | `JOY_BUTTON_RIGHT_STICK` | `JOY_BUTTON_LEFT_SHOULDER` | `JOY_BUTTON_RIGHT_SHOULDER` | `JOY_BUTTON_DPAD_UP` | `JOY_BUTTON_DPAD_DOWN` | `JOY_BUTTON_DPAD_LEFT` | `JOY_BUTTON_DPAD_RIGHT` | `JOY_BUTTON_MISC1` | `JOY_BUTTON_PADDLE1` | `JOY_BUTTON_PADDLE2` | `JOY_BUTTON_PADDLE3` | `JOY_BUTTON_PADDLE4` | `JOY_BUTTON_TOUCHPAD` | `JOY_BUTTON_SDL_MAX` | `JOY_BUTTON_MAX`
JOY_BUTTON_INVALID = -1
JOY_BUTTON_A = 0
JOY_BUTTON_B = 1
JOY_BUTTON_X = 2
JOY_BUTTON_Y = 3
JOY_BUTTON_BACK = 4
JOY_BUTTON_GUIDE = 5
JOY_BUTTON_START = 6
JOY_BUTTON_LEFT_STICK = 7
JOY_BUTTON_RIGHT_STICK = 8
JOY_BUTTON_LEFT_SHOULDER = 9
JOY_BUTTON_RIGHT_SHOULDER = 10
JOY_BUTTON_DPAD_UP = 11
JOY_BUTTON_DPAD_DOWN = 12
JOY_BUTTON_DPAD_LEFT = 13
JOY_BUTTON_DPAD_RIGHT = 14
JOY_BUTTON_MISC1 = 15
JOY_BUTTON_PADDLE1 = 16
JOY_BUTTON_PADDLE2 = 17
JOY_BUTTON_PADDLE3 = 18
JOY_BUTTON_PADDLE4 = 19
JOY_BUTTON_TOUCHPAD = 20
JOY_BUTTON_SDL_MAX = 21
JOY_BUTTON_MAX = 128
--- @alias JoyAxis `JOY_AXIS_INVALID` | `JOY_AXIS_LEFT_X` | `JOY_AXIS_LEFT_Y` | `JOY_AXIS_RIGHT_X` | `JOY_AXIS_RIGHT_Y` | `JOY_AXIS_TRIGGER_LEFT` | `JOY_AXIS_TRIGGER_RIGHT` | `JOY_AXIS_SDL_MAX` | `JOY_AXIS_MAX`
JOY_AXIS_INVALID = -1
JOY_AXIS_LEFT_X = 0
JOY_AXIS_LEFT_Y = 1
JOY_AXIS_RIGHT_X = 2
JOY_AXIS_RIGHT_Y = 3
JOY_AXIS_TRIGGER_LEFT = 4
JOY_AXIS_TRIGGER_RIGHT = 5
JOY_AXIS_SDL_MAX = 6
JOY_AXIS_MAX = 10
--- @alias MIDIMessage `MIDI_MESSAGE_NONE` | `MIDI_MESSAGE_NOTE_OFF` | `MIDI_MESSAGE_NOTE_ON` | `MIDI_MESSAGE_AFTERTOUCH` | `MIDI_MESSAGE_CONTROL_CHANGE` | `MIDI_MESSAGE_PROGRAM_CHANGE` | `MIDI_MESSAGE_CHANNEL_PRESSURE` | `MIDI_MESSAGE_PITCH_BEND` | `MIDI_MESSAGE_SYSTEM_EXCLUSIVE` | `MIDI_MESSAGE_QUARTER_FRAME` | `MIDI_MESSAGE_SONG_POSITION_POINTER` | `MIDI_MESSAGE_SONG_SELECT` | `MIDI_MESSAGE_TUNE_REQUEST` | `MIDI_MESSAGE_TIMING_CLOCK` | `MIDI_MESSAGE_START` | `MIDI_MESSAGE_CONTINUE` | `MIDI_MESSAGE_STOP` | `MIDI_MESSAGE_ACTIVE_SENSING` | `MIDI_MESSAGE_SYSTEM_RESET`
MIDI_MESSAGE_NONE = 0
MIDI_MESSAGE_NOTE_OFF = 8
MIDI_MESSAGE_NOTE_ON = 9
MIDI_MESSAGE_AFTERTOUCH = 10
MIDI_MESSAGE_CONTROL_CHANGE = 11
MIDI_MESSAGE_PROGRAM_CHANGE = 12
MIDI_MESSAGE_CHANNEL_PRESSURE = 13
MIDI_MESSAGE_PITCH_BEND = 14
MIDI_MESSAGE_SYSTEM_EXCLUSIVE = 240
MIDI_MESSAGE_QUARTER_FRAME = 241
MIDI_MESSAGE_SONG_POSITION_POINTER = 242
MIDI_MESSAGE_SONG_SELECT = 243
MIDI_MESSAGE_TUNE_REQUEST = 246
MIDI_MESSAGE_TIMING_CLOCK = 248
MIDI_MESSAGE_START = 250
MIDI_MESSAGE_CONTINUE = 251
MIDI_MESSAGE_STOP = 252
MIDI_MESSAGE_ACTIVE_SENSING = 254
MIDI_MESSAGE_SYSTEM_RESET = 255
--- @alias Error `OK` | `FAILED` | `ERR_UNAVAILABLE` | `ERR_UNCONFIGURED` | `ERR_UNAUTHORIZED` | `ERR_PARAMETER_RANGE_ERROR` | `ERR_OUT_OF_MEMORY` | `ERR_FILE_NOT_FOUND` | `ERR_FILE_BAD_DRIVE` | `ERR_FILE_BAD_PATH` | `ERR_FILE_NO_PERMISSION` | `ERR_FILE_ALREADY_IN_USE` | `ERR_FILE_CANT_OPEN` | `ERR_FILE_CANT_WRITE` | `ERR_FILE_CANT_READ` | `ERR_FILE_UNRECOGNIZED` | `ERR_FILE_CORRUPT` | `ERR_FILE_MISSING_DEPENDENCIES` | `ERR_FILE_EOF` | `ERR_CANT_OPEN` | `ERR_CANT_CREATE` | `ERR_QUERY_FAILED` | `ERR_ALREADY_IN_USE` | `ERR_LOCKED` | `ERR_TIMEOUT` | `ERR_CANT_CONNECT` | `ERR_CANT_RESOLVE` | `ERR_CONNECTION_ERROR` | `ERR_CANT_ACQUIRE_RESOURCE` | `ERR_CANT_FORK` | `ERR_INVALID_DATA` | `ERR_INVALID_PARAMETER` | `ERR_ALREADY_EXISTS` | `ERR_DOES_NOT_EXIST` | `ERR_DATABASE_CANT_READ` | `ERR_DATABASE_CANT_WRITE` | `ERR_COMPILATION_FAILED` | `ERR_METHOD_NOT_FOUND` | `ERR_LINK_FAILED` | `ERR_SCRIPT_FAILED` | `ERR_CYCLIC_LINK` | `ERR_INVALID_DECLARATION` | `ERR_DUPLICATE_SYMBOL` | `ERR_PARSE_ERROR` | `ERR_BUSY` | `ERR_SKIP` | `ERR_HELP` | `ERR_BUG` | `ERR_PRINTER_ON_FIRE`
OK = 0
FAILED = 1
ERR_UNAVAILABLE = 2
ERR_UNCONFIGURED = 3
ERR_UNAUTHORIZED = 4
ERR_PARAMETER_RANGE_ERROR = 5
ERR_OUT_OF_MEMORY = 6
ERR_FILE_NOT_FOUND = 7
ERR_FILE_BAD_DRIVE = 8
ERR_FILE_BAD_PATH = 9
ERR_FILE_NO_PERMISSION = 10
ERR_FILE_ALREADY_IN_USE = 11
ERR_FILE_CANT_OPEN = 12
ERR_FILE_CANT_WRITE = 13
ERR_FILE_CANT_READ = 14
ERR_FILE_UNRECOGNIZED = 15
ERR_FILE_CORRUPT = 16
ERR_FILE_MISSING_DEPENDENCIES = 17
ERR_FILE_EOF = 18
ERR_CANT_OPEN = 19
ERR_CANT_CREATE = 20
ERR_QUERY_FAILED = 21
ERR_ALREADY_IN_USE = 22
ERR_LOCKED = 23
ERR_TIMEOUT = 24
ERR_CANT_CONNECT = 25
ERR_CANT_RESOLVE = 26
ERR_CONNECTION_ERROR = 27
ERR_CANT_ACQUIRE_RESOURCE = 28
ERR_CANT_FORK = 29
ERR_INVALID_DATA = 30
ERR_INVALID_PARAMETER = 31
ERR_ALREADY_EXISTS = 32
ERR_DOES_NOT_EXIST = 33
ERR_DATABASE_CANT_READ = 34
ERR_DATABASE_CANT_WRITE = 35
ERR_COMPILATION_FAILED = 36
ERR_METHOD_NOT_FOUND = 37
ERR_LINK_FAILED = 38
ERR_SCRIPT_FAILED = 39
ERR_CYCLIC_LINK = 40
ERR_INVALID_DECLARATION = 41
ERR_DUPLICATE_SYMBOL = 42
ERR_PARSE_ERROR = 43
ERR_BUSY = 44
ERR_SKIP = 45
ERR_HELP = 46
ERR_BUG = 47
ERR_PRINTER_ON_FIRE = 48
--- @alias PropertyHint `PROPERTY_HINT_NONE` | `PROPERTY_HINT_RANGE` | `PROPERTY_HINT_ENUM` | `PROPERTY_HINT_ENUM_SUGGESTION` | `PROPERTY_HINT_EXP_EASING` | `PROPERTY_HINT_LINK` | `PROPERTY_HINT_FLAGS` | `PROPERTY_HINT_LAYERS_2D_RENDER` | `PROPERTY_HINT_LAYERS_2D_PHYSICS` | `PROPERTY_HINT_LAYERS_2D_NAVIGATION` | `PROPERTY_HINT_LAYERS_3D_RENDER` | `PROPERTY_HINT_LAYERS_3D_PHYSICS` | `PROPERTY_HINT_LAYERS_3D_NAVIGATION` | `PROPERTY_HINT_LAYERS_AVOIDANCE` | `PROPERTY_HINT_FILE` | `PROPERTY_HINT_DIR` | `PROPERTY_HINT_GLOBAL_FILE` | `PROPERTY_HINT_GLOBAL_DIR` | `PROPERTY_HINT_RESOURCE_TYPE` | `PROPERTY_HINT_MULTILINE_TEXT` | `PROPERTY_HINT_EXPRESSION` | `PROPERTY_HINT_PLACEHOLDER_TEXT` | `PROPERTY_HINT_COLOR_NO_ALPHA` | `PROPERTY_HINT_OBJECT_ID` | `PROPERTY_HINT_TYPE_STRING` | `PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE` | `PROPERTY_HINT_OBJECT_TOO_BIG` | `PROPERTY_HINT_NODE_PATH_VALID_TYPES` | `PROPERTY_HINT_SAVE_FILE` | `PROPERTY_HINT_GLOBAL_SAVE_FILE` | `PROPERTY_HINT_INT_IS_OBJECTID` | `PROPERTY_HINT_INT_IS_POINTER` | `PROPERTY_HINT_ARRAY_TYPE` | `PROPERTY_HINT_DICTIONARY_TYPE` | `PROPERTY_HINT_LOCALE_ID` | `PROPERTY_HINT_LOCALIZABLE_STRING` | `PROPERTY_HINT_NODE_TYPE` | `PROPERTY_HINT_HIDE_QUATERNION_EDIT` | `PROPERTY_HINT_PASSWORD` | `PROPERTY_HINT_TOOL_BUTTON` | `PROPERTY_HINT_ONESHOT` | `PROPERTY_HINT_GROUP_ENABLE` | `PROPERTY_HINT_INPUT_NAME` | `PROPERTY_HINT_FILE_PATH` | `PROPERTY_HINT_MAX`
PROPERTY_HINT_NONE = 0
PROPERTY_HINT_RANGE = 1
PROPERTY_HINT_ENUM = 2
PROPERTY_HINT_ENUM_SUGGESTION = 3
PROPERTY_HINT_EXP_EASING = 4
PROPERTY_HINT_LINK = 5
PROPERTY_HINT_FLAGS = 6
PROPERTY_HINT_LAYERS_2D_RENDER = 7
PROPERTY_HINT_LAYERS_2D_PHYSICS = 8
PROPERTY_HINT_LAYERS_2D_NAVIGATION = 9
PROPERTY_HINT_LAYERS_3D_RENDER = 10
PROPERTY_HINT_LAYERS_3D_PHYSICS = 11
PROPERTY_HINT_LAYERS_3D_NAVIGATION = 12
PROPERTY_HINT_LAYERS_AVOIDANCE = 37
PROPERTY_HINT_FILE = 13
PROPERTY_HINT_DIR = 14
PROPERTY_HINT_GLOBAL_FILE = 15
PROPERTY_HINT_GLOBAL_DIR = 16
PROPERTY_HINT_RESOURCE_TYPE = 17
PROPERTY_HINT_MULTILINE_TEXT = 18
PROPERTY_HINT_EXPRESSION = 19
PROPERTY_HINT_PLACEHOLDER_TEXT = 20
PROPERTY_HINT_COLOR_NO_ALPHA = 21
PROPERTY_HINT_OBJECT_ID = 22
PROPERTY_HINT_TYPE_STRING = 23
PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE = 24
PROPERTY_HINT_OBJECT_TOO_BIG = 25
PROPERTY_HINT_NODE_PATH_VALID_TYPES = 26
PROPERTY_HINT_SAVE_FILE = 27
PROPERTY_HINT_GLOBAL_SAVE_FILE = 28
PROPERTY_HINT_INT_IS_OBJECTID = 29
PROPERTY_HINT_INT_IS_POINTER = 30
PROPERTY_HINT_ARRAY_TYPE = 31
PROPERTY_HINT_DICTIONARY_TYPE = 38
PROPERTY_HINT_LOCALE_ID = 32
PROPERTY_HINT_LOCALIZABLE_STRING = 33
PROPERTY_HINT_NODE_TYPE = 34
PROPERTY_HINT_HIDE_QUATERNION_EDIT = 35
PROPERTY_HINT_PASSWORD = 36
PROPERTY_HINT_TOOL_BUTTON = 39
PROPERTY_HINT_ONESHOT = 40
PROPERTY_HINT_GROUP_ENABLE = 42
PROPERTY_HINT_INPUT_NAME = 43
PROPERTY_HINT_FILE_PATH = 44
PROPERTY_HINT_MAX = 45
--- @alias PropertyUsageFlags `PROPERTY_USAGE_NONE` | `PROPERTY_USAGE_STORAGE` | `PROPERTY_USAGE_EDITOR` | `PROPERTY_USAGE_INTERNAL` | `PROPERTY_USAGE_CHECKABLE` | `PROPERTY_USAGE_CHECKED` | `PROPERTY_USAGE_GROUP` | `PROPERTY_USAGE_CATEGORY` | `PROPERTY_USAGE_SUBGROUP` | `PROPERTY_USAGE_CLASS_IS_BITFIELD` | `PROPERTY_USAGE_NO_INSTANCE_STATE` | `PROPERTY_USAGE_RESTART_IF_CHANGED` | `PROPERTY_USAGE_SCRIPT_VARIABLE` | `PROPERTY_USAGE_STORE_IF_NULL` | `PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED` | `PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE` | `PROPERTY_USAGE_CLASS_IS_ENUM` | `PROPERTY_USAGE_NIL_IS_VARIANT` | `PROPERTY_USAGE_ARRAY` | `PROPERTY_USAGE_ALWAYS_DUPLICATE` | `PROPERTY_USAGE_NEVER_DUPLICATE` | `PROPERTY_USAGE_HIGH_END_GFX` | `PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT` | `PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT` | `PROPERTY_USAGE_KEYING_INCREMENTS` | `PROPERTY_USAGE_DEFERRED_SET_RESOURCE` | `PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT` | `PROPERTY_USAGE_EDITOR_BASIC_SETTING` | `PROPERTY_USAGE_READ_ONLY` | `PROPERTY_USAGE_SECRET` | `PROPERTY_USAGE_DEFAULT` | `PROPERTY_USAGE_NO_EDITOR`
PROPERTY_USAGE_NONE = 0
PROPERTY_USAGE_STORAGE = 2
PROPERTY_USAGE_EDITOR = 4
PROPERTY_USAGE_INTERNAL = 8
PROPERTY_USAGE_CHECKABLE = 16
PROPERTY_USAGE_CHECKED = 32
PROPERTY_USAGE_GROUP = 64
PROPERTY_USAGE_CATEGORY = 128
PROPERTY_USAGE_SUBGROUP = 256
PROPERTY_USAGE_CLASS_IS_BITFIELD = 512
PROPERTY_USAGE_NO_INSTANCE_STATE = 1024
PROPERTY_USAGE_RESTART_IF_CHANGED = 2048
PROPERTY_USAGE_SCRIPT_VARIABLE = 4096
PROPERTY_USAGE_STORE_IF_NULL = 8192
PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 16384
PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE = 32768
PROPERTY_USAGE_CLASS_IS_ENUM = 65536
PROPERTY_USAGE_NIL_IS_VARIANT = 131072
PROPERTY_USAGE_ARRAY = 262144
PROPERTY_USAGE_ALWAYS_DUPLICATE = 524288
PROPERTY_USAGE_NEVER_DUPLICATE = 1048576
PROPERTY_USAGE_HIGH_END_GFX = 2097152
PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT = 4194304
PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT = 8388608
PROPERTY_USAGE_KEYING_INCREMENTS = 16777216
PROPERTY_USAGE_DEFERRED_SET_RESOURCE = 33554432
PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT = 67108864
PROPERTY_USAGE_EDITOR_BASIC_SETTING = 134217728
PROPERTY_USAGE_READ_ONLY = 268435456
PROPERTY_USAGE_SECRET = 536870912
PROPERTY_USAGE_DEFAULT = 6
PROPERTY_USAGE_NO_EDITOR = 2
--- @alias MethodFlags `METHOD_FLAG_NORMAL` | `METHOD_FLAG_EDITOR` | `METHOD_FLAG_CONST` | `METHOD_FLAG_VIRTUAL` | `METHOD_FLAG_VARARG` | `METHOD_FLAG_STATIC` | `METHOD_FLAG_OBJECT_CORE` | `METHOD_FLAG_VIRTUAL_REQUIRED` | `METHOD_FLAGS_DEFAULT`
METHOD_FLAG_NORMAL = 1
METHOD_FLAG_EDITOR = 2
METHOD_FLAG_CONST = 4
METHOD_FLAG_VIRTUAL = 8
METHOD_FLAG_VARARG = 16
METHOD_FLAG_STATIC = 32
METHOD_FLAG_OBJECT_CORE = 64
METHOD_FLAG_VIRTUAL_REQUIRED = 128
METHOD_FLAGS_DEFAULT = 1
--- @alias Variant.Type `TYPE_NIL` | `TYPE_BOOL` | `TYPE_INT` | `TYPE_FLOAT` | `TYPE_STRING` | `TYPE_VECTOR2` | `TYPE_VECTOR2I` | `TYPE_RECT2` | `TYPE_RECT2I` | `TYPE_VECTOR3` | `TYPE_VECTOR3I` | `TYPE_TRANSFORM2D` | `TYPE_VECTOR4` | `TYPE_VECTOR4I` | `TYPE_PLANE` | `TYPE_QUATERNION` | `TYPE_AABB` | `TYPE_BASIS` | `TYPE_TRANSFORM3D` | `TYPE_PROJECTION` | `TYPE_COLOR` | `TYPE_STRING_NAME` | `TYPE_NODE_PATH` | `TYPE_RID` | `TYPE_OBJECT` | `TYPE_CALLABLE` | `TYPE_SIGNAL` | `TYPE_DICTIONARY` | `TYPE_ARRAY` | `TYPE_PACKED_BYTE_ARRAY` | `TYPE_PACKED_INT32_ARRAY` | `TYPE_PACKED_INT64_ARRAY` | `TYPE_PACKED_FLOAT32_ARRAY` | `TYPE_PACKED_FLOAT64_ARRAY` | `TYPE_PACKED_STRING_ARRAY` | `TYPE_PACKED_VECTOR2_ARRAY` | `TYPE_PACKED_VECTOR3_ARRAY` | `TYPE_PACKED_COLOR_ARRAY` | `TYPE_PACKED_VECTOR4_ARRAY` | `TYPE_MAX`
TYPE_NIL = 0
TYPE_BOOL = 1
TYPE_INT = 2
TYPE_FLOAT = 3
TYPE_STRING = 4
TYPE_VECTOR2 = 5
TYPE_VECTOR2I = 6
TYPE_RECT2 = 7
TYPE_RECT2I = 8
TYPE_VECTOR3 = 9
TYPE_VECTOR3I = 10
TYPE_TRANSFORM2D = 11
TYPE_VECTOR4 = 12
TYPE_VECTOR4I = 13
TYPE_PLANE = 14
TYPE_QUATERNION = 15
TYPE_AABB = 16
TYPE_BASIS = 17
TYPE_TRANSFORM3D = 18
TYPE_PROJECTION = 19
TYPE_COLOR = 20
TYPE_STRING_NAME = 21
TYPE_NODE_PATH = 22
TYPE_RID = 23
TYPE_OBJECT = 24
TYPE_CALLABLE = 25
TYPE_SIGNAL = 26
TYPE_DICTIONARY = 27
TYPE_ARRAY = 28
TYPE_PACKED_BYTE_ARRAY = 29
TYPE_PACKED_INT32_ARRAY = 30
TYPE_PACKED_INT64_ARRAY = 31
TYPE_PACKED_FLOAT32_ARRAY = 32
TYPE_PACKED_FLOAT64_ARRAY = 33
TYPE_PACKED_STRING_ARRAY = 34
TYPE_PACKED_VECTOR2_ARRAY = 35
TYPE_PACKED_VECTOR3_ARRAY = 36
TYPE_PACKED_COLOR_ARRAY = 37
TYPE_PACKED_VECTOR4_ARRAY = 38
TYPE_MAX = 39
--- @alias Variant.Operator `OP_EQUAL` | `OP_NOT_EQUAL` | `OP_LESS` | `OP_LESS_EQUAL` | `OP_GREATER` | `OP_GREATER_EQUAL` | `OP_ADD` | `OP_SUBTRACT` | `OP_MULTIPLY` | `OP_DIVIDE` | `OP_NEGATE` | `OP_POSITIVE` | `OP_MODULE` | `OP_POWER` | `OP_SHIFT_LEFT` | `OP_SHIFT_RIGHT` | `OP_BIT_AND` | `OP_BIT_OR` | `OP_BIT_XOR` | `OP_BIT_NEGATE` | `OP_AND` | `OP_OR` | `OP_XOR` | `OP_NOT` | `OP_IN` | `OP_MAX`
OP_EQUAL = 0
OP_NOT_EQUAL = 1
OP_LESS = 2
OP_LESS_EQUAL = 3
OP_GREATER = 4
OP_GREATER_EQUAL = 5
OP_ADD = 6
OP_SUBTRACT = 7
OP_MULTIPLY = 8
OP_DIVIDE = 9
OP_NEGATE = 10
OP_POSITIVE = 11
OP_MODULE = 12
OP_POWER = 13
OP_SHIFT_LEFT = 14
OP_SHIFT_RIGHT = 15
OP_BIT_AND = 16
OP_BIT_OR = 17
OP_BIT_XOR = 18
OP_BIT_NEGATE = 19
OP_AND = 20
OP_OR = 21
OP_XOR = 22
OP_NOT = 23
OP_IN = 24
OP_MAX = 25

View File

@@ -0,0 +1,273 @@
--- @meta
-----------------------------------------------------------
-- Properties
-----------------------------------------------------------
--- @class LuaScriptProperty
--- Property definition for Lua scripts.
LuaScriptProperty = {}
--- Used to define custom properties in Lua scripts.
--- If you pass a table, the following keys are used (all are optional):
--- + `1`: if it's a Variant type or Class (like `Dictionary` or `Node2D`) it represents the property type.
--- Otherwise, it represents the property's default value.
--- + `type`: should be a Variant type or a Class, such as `Vector2` or `RefCounted`.
--- + `hint`: property hint (check out the `PropertyHint` enum for available values)
--- + `hint_string`: property hint string, depends on the value of `hint`
--- + `usage`: property usage flags (check out the `PropertyUsage` enum for available values)
--- + `class_name`: the name of the Class, filled automatically from `type` if it's a Class type
--- + `default`: the default value of the property
--- + `get`: getter function, should be either a Lua function or a string containing the getter method name
--- + `set`: setter function, should be either a Lua function or a string containing the setter method name
---
--- In case `t` is not a table, the table `{t}` will be used instead.
--- @param t table | any
--- @return LuaScriptProperty
function property(t) end
--- Same as `property`, but always adds `PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_STORAGE` to the property's usage flags.
--- Similar to GDScript's `@export` annotation.
--- @see property
--- @param t table | any
--- @return LuaScriptProperty
function export(t) end
--- Creates a `PROPERTY_USAGE_CATEGORY` property.
--- Note that the category name will be the key used in your class for this property.
--- @return LuaScriptProperty
function export_category() end
--- Same as `export`, but always adds `PROPERTY_HINT_COLOR_NO_ALPHA` to the property's usage flags.
--- Similar to GDScript's `@export_color_no_alpha` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_color_no_alpha(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_DIR` to the property's usage flags.
--- Similar to GDScript's `@export_dir` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_dir(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_ENUM` to the property's hint flags.
--- String arguments will be used as the property's `hint_string`.
--- The first argument that is not a string is forwarded to `export`
--- Similar to GDScript's `export_enum` annotation.
--- @see export
--- @param ... string | any
--- @return LuaScriptProperty
function export_enum(...) end
--- Same as `export`, but always adds `PROPERTY_HINT_EXP_EASING` to the property's hint flags.
--- String arguments will be used as the property's `hint_string`.
--- The first argument that is not a string is forwarded to `export`
--- Similar to GDScript's `export_exp_easing` annotation.
--- @see export
--- @param ... string | any
--- @return LuaScriptProperty
function export_exp_easing(...) end
--- Same as `export`, but always adds `PROPERTY_HINT_FILE` to the property's hint flags.
--- String arguments will be used as the property's `hint_string`.
--- The first argument that is not a string is forwarded to `export`
--- Similar to GDScript's `export_file` annotation.
--- @see export
--- @param ... string | any
--- @return LuaScriptProperty
function export_file(...) end
--- Same as `export`, but always adds `PROPERTY_HINT_FLAGS` to the property's hint flags.
--- String arguments will be used as the property's `hint_string`.
--- The first argument that is not a string is forwarded to `export`
--- Similar to GDScript's `export_flags` annotation.
--- @see export
--- @param ... string | any
--- @return LuaScriptProperty
function export_flags(...) end
--- Same as `export`, but always adds `PROPERTY_HINT_LAYERS_2D_NAVIGATION` to the property's usage flags.
--- Similar to GDScript's `@export_flags_2d_navigation` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_flags_2d_navigation(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_LAYERS_2D_PHYSICS` to the property's usage flags.
--- Similar to GDScript's `@export_flags_2d_physics` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_flags_2d_physics(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_LAYERS_2D_RENDER` to the property's usage flags.
--- Similar to GDScript's `@export_flags_2d_render` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_flags_2d_render(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_LAYERS_3D_NAVIGATION` to the property's usage flags.
--- Similar to GDScript's `@export_flags_3d_navigation` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_flags_3d_navigation(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_LAYERS_3D_PHYSICS` to the property's usage flags.
--- Similar to GDScript's `@export_flags_3d_physics` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_flags_3d_physics(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_LAYERS_3D_RENDER` to the property's usage flags.
--- Similar to GDScript's `@export_flags_3d_render` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_flags_3d_render(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_LAYERS_AVOIDANCE` to the property's usage flags.
--- Similar to GDScript's `@export_flags_avoidance` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_flags_avoidance(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_GLOBAL_DIR` to the property's usage flags.
--- Similar to GDScript's `@export_global_dir` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_global_dir(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_GLOBAL_FILE` to the property's hint flags.
--- String arguments will be used as the property's `hint_string`.
--- The first argument that is not a string is forwarded to `export`
--- Similar to GDScript's `export_global_file` annotation.
--- @see export
--- @param ... string | any
--- @return LuaScriptProperty
function export_global_file(...) end
--- Creates a `PROPERTY_USAGE_GROUP` property.
--- Note that the group name will be the key used in your class for this property.
--- @param prefix string?
--- @return LuaScriptProperty
function export_group(prefix) end
--- Same as `export`, but always adds `PROPERTY_HINT_MULTILINE_TEXT` to the property's usage flags.
--- Similar to GDScript's `@export_multiline` annotation.
--- @see export
--- @param t table | any
--- @return LuaScriptProperty
function export_multiline(t) end
--- Same as `export`, but always adds `PROPERTY_HINT_NODE_PATH_VALID_TYPES` to the property's hint flags.
--- String arguments will be used as the property's `hint_string`.
--- The first argument that is not a string is forwarded to `export`
--- Similar to GDScript's `export_node_path` annotation.
--- @see export
--- @param ... string | any
--- @return LuaScriptProperty
function export_node_path(...) end
--- Same as `export`, but always adds `PROPERTY_HINT_PLACEHOLDER_TEXT` to the property's hint flags.
--- String arguments will be used as the property's `hint_string`.
--- The first argument that is not a string is forwarded to `export`
--- Similar to GDScript's `export_placeholder` annotation.
--- @see export
--- @param ... string | any
--- @return LuaScriptProperty
function export_placeholder(...) end
--- Same as `export`, but always adds `PROPERTY_HINT_RANGE` to the property's hint flags.
--- The first argument that is not a number or string is forwarded to `export`.
--- Similar to GDScript's `export_node_path` annotation.
--- @see export
--- @param ... string | any
--- @return LuaScriptProperty
function export_range(...) end
--- Used to define exported properties in Lua scripts.
--- This is the same as `property`, but always adds `PROPERTY_USAGE_STORAGE` to the property's usage flags.
--- @see property
--- @param t table | any
--- @return LuaScriptProperty
function export_storage(t) end
--- Creates a `PROPERTY_USAGE_SUBGROUP` property.
--- Note that the subgroup name will be the key used in your class for this property.
--- @param prefix string?
--- @return LuaScriptProperty
function export_subgroup(prefix) end
--- Same as `export`, but always adds `PROPERTY_HINT_TOOL_BUTTON` to the property's hint flags.
--- The first argument that is not a string is forwarded to `export`.
--- Similar to GDScript's `export_node_path` annotation.
--- @see export
--- @param ... string | any
--- @return LuaScriptProperty
function export_tool_button(...) end
-----------------------------------------------------------
-- Signals
-----------------------------------------------------------
--- @class LuaScriptSignal
--- Signal definition for Lua scripts.
LuaScriptSignal = {}
--- Used to define custom signals in Lua scripts.
--- For now there is no way to pass type information for arguments, only their names.
--- ```
--- local MyClass = {}
--- MyClass.some_signal = signal("argument1", "argument2")
--- return MyClass
--- ```
--- @param ... string
--- @return LuaScriptSignal
function signal(...) end
-----------------------------------------------------------
-- RPC configuration
-----------------------------------------------------------
--- Similar to GDScript's `@rpc` annotation, should be used to initialize the special `rpc_config` table.
--- Example:
--- ```
--- local MyClass = {}
---
--- function MyClass:some_method() end
--- function MyClass:some_other_method() end
---
--- MyClass.rpc_config = {
--- "some_method" = rpc("any_peer", "call_local", "reliable", 0),
--- "some_other_method" = rpc("reliable", 1),
--- }
---
--- return MyClass
--- ```
--- See [@rpc](https://docs.godotengine.org/en/stable/classes/class_@gdscript.html#class-gdscript-annotation-rpc) for more information.
---
--- @param mode "any_peer" | "authority" | nil
--- @param sync "call_remote" | "call_local" | nil
--- @param transfer_mode "unreliable" | "unreliable_ordered" | "reliable" | nil
--- @param transfer_channel integer?
function rpc(mode, sync, transfer_mode, transfer_channel) end
-----------------------------------------------------------
-- Misc
-----------------------------------------------------------
--- Creates a table suitable for defining Godot Classes in Lua scripts.
--- The only thing special about it is that `pairs` iterates over its keys in order of insertion,
--- so that its properties and methods are shown in order of definition in the Godot Editor.
--- @return table
function GDCLASS() end

View File

@@ -0,0 +1,23 @@
--- @meta
--- Yields the current coroutine until the passed signal is emitted.
--- If an Object is passed, awaits for its 'completed' signal.
--- This function should only be called inside a coroutine.
---
--- Note: only available if `GODOT_UTILITY_FUNCTIONS` library is open in the LuaState.
--- @param awaitable Object | Signal
--- @return any
function await(awaitable) end
--- Returns the Variant type of the passed value.
--- Contrary to GDScript's `typeof`, in Lua this does not return the enum like `TYPE_BOOL` or `TYPE_DICTIONARY`, but rather the actual class type like `bool` or `Dictionary`.
--- ```
--- if typeof(some_value) == Dictionary then
--- -- ...
--- end
--- ```
--- Note: only available if `GODOT_VARIANT` library is open in the LuaState.
--- @param value any
--- @return userdata?
function typeof(value) end

View File

@@ -0,0 +1,522 @@
--- This file was automatically generated by generate_lua_godot_api.py
--- @meta
--- @param angle_rad float
--- @return float
function sin(angle_rad) end
--- @param angle_rad float
--- @return float
function cos(angle_rad) end
--- @param angle_rad float
--- @return float
function tan(angle_rad) end
--- @param x float
--- @return float
function sinh(x) end
--- @param x float
--- @return float
function cosh(x) end
--- @param x float
--- @return float
function tanh(x) end
--- @param x float
--- @return float
function asin(x) end
--- @param x float
--- @return float
function acos(x) end
--- @param x float
--- @return float
function atan(x) end
--- @param y float
--- @param x float
--- @return float
function atan2(y, x) end
--- @param x float
--- @return float
function asinh(x) end
--- @param x float
--- @return float
function acosh(x) end
--- @param x float
--- @return float
function atanh(x) end
--- @param x float
--- @return float
function sqrt(x) end
--- @param x float
--- @param y float
--- @return float
function fmod(x, y) end
--- @param x float
--- @param y float
--- @return float
function fposmod(x, y) end
--- @param x int
--- @param y int
--- @return int
function posmod(x, y) end
--- @param x any
--- @return any
function floor(x) end
--- @param x float
--- @return float
function floorf(x) end
--- @param x float
--- @return int
function floori(x) end
--- @param x any
--- @return any
function ceil(x) end
--- @param x float
--- @return float
function ceilf(x) end
--- @param x float
--- @return int
function ceili(x) end
--- @param x any
--- @return any
function round(x) end
--- @param x float
--- @return float
function roundf(x) end
--- @param x float
--- @return int
function roundi(x) end
--- @param x any
--- @return any
function abs(x) end
--- @param x float
--- @return float
function absf(x) end
--- @param x int
--- @return int
function absi(x) end
--- @param x any
--- @return any
function sign(x) end
--- @param x float
--- @return float
function signf(x) end
--- @param x int
--- @return int
function signi(x) end
--- @param x any
--- @param step any
--- @return any
function snapped(x, step) end
--- @param x float
--- @param step float
--- @return float
function snappedf(x, step) end
--- @param x float
--- @param step int
--- @return int
function snappedi(x, step) end
--- @param base float
--- @param exp float
--- @return float
function pow(base, exp) end
--- @param x float
--- @return float
function log(x) end
--- @param x float
--- @return float
function exp(x) end
--- @param x float
--- @return bool
function is_nan(x) end
--- @param x float
--- @return bool
function is_inf(x) end
--- @param a float
--- @param b float
--- @return bool
function is_equal_approx(a, b) end
--- @param x float
--- @return bool
function is_zero_approx(x) end
--- @param x float
--- @return bool
function is_finite(x) end
--- @param x float
--- @param curve float
--- @return float
function ease(x, curve) end
--- @param x float
--- @return int
function step_decimals(x) end
--- @param from any
--- @param to any
--- @param weight any
--- @return any
function lerp(from, to, weight) end
--- @param from float
--- @param to float
--- @param weight float
--- @return float
function lerpf(from, to, weight) end
--- @param from float
--- @param to float
--- @param pre float
--- @param post float
--- @param weight float
--- @return float
function cubic_interpolate(from, to, pre, post, weight) end
--- @param from float
--- @param to float
--- @param pre float
--- @param post float
--- @param weight float
--- @return float
function cubic_interpolate_angle(from, to, pre, post, weight) end
--- @param from float
--- @param to float
--- @param pre float
--- @param post float
--- @param weight float
--- @param to_t float
--- @param pre_t float
--- @param post_t float
--- @return float
function cubic_interpolate_in_time(from, to, pre, post, weight, to_t, pre_t, post_t) end
--- @param from float
--- @param to float
--- @param pre float
--- @param post float
--- @param weight float
--- @param to_t float
--- @param pre_t float
--- @param post_t float
--- @return float
function cubic_interpolate_angle_in_time(from, to, pre, post, weight, to_t, pre_t, post_t) end
--- @param start float
--- @param control_1 float
--- @param control_2 float
--- @param _end float
--- @param t float
--- @return float
function bezier_interpolate(start, control_1, control_2, _end, t) end
--- @param start float
--- @param control_1 float
--- @param control_2 float
--- @param _end float
--- @param t float
--- @return float
function bezier_derivative(start, control_1, control_2, _end, t) end
--- @param from float
--- @param to float
--- @return float
function angle_difference(from, to) end
--- @param from float
--- @param to float
--- @param weight float
--- @return float
function lerp_angle(from, to, weight) end
--- @param from float
--- @param to float
--- @param weight float
--- @return float
function inverse_lerp(from, to, weight) end
--- @param value float
--- @param istart float
--- @param istop float
--- @param ostart float
--- @param ostop float
--- @return float
function remap(value, istart, istop, ostart, ostop) end
--- @param from float
--- @param to float
--- @param x float
--- @return float
function smoothstep(from, to, x) end
--- @param from float
--- @param to float
--- @param delta float
--- @return float
function move_toward(from, to, delta) end
--- @param from float
--- @param to float
--- @param delta float
--- @return float
function rotate_toward(from, to, delta) end
--- @param deg float
--- @return float
function deg_to_rad(deg) end
--- @param rad float
--- @return float
function rad_to_deg(rad) end
--- @param lin float
--- @return float
function linear_to_db(lin) end
--- @param db float
--- @return float
function db_to_linear(db) end
--- @param value any
--- @param min any
--- @param max any
--- @return any
function wrap(value, min, max) end
--- @param value int
--- @param min int
--- @param max int
--- @return int
function wrapi(value, min, max) end
--- @param value float
--- @param min float
--- @param max float
--- @return float
function wrapf(value, min, max) end
--- @param arg1 any
--- @param arg2 any
--- @return any
function max(arg1, arg2, ...) end
--- @param a int
--- @param b int
--- @return int
function maxi(a, b) end
--- @param a float
--- @param b float
--- @return float
function maxf(a, b) end
--- @param arg1 any
--- @param arg2 any
--- @return any
function min(arg1, arg2, ...) end
--- @param a int
--- @param b int
--- @return int
function mini(a, b) end
--- @param a float
--- @param b float
--- @return float
function minf(a, b) end
--- @param value any
--- @param min any
--- @param max any
--- @return any
function clamp(value, min, max) end
--- @param value int
--- @param min int
--- @param max int
--- @return int
function clampi(value, min, max) end
--- @param value float
--- @param min float
--- @param max float
--- @return float
function clampf(value, min, max) end
--- @param value int
--- @return int
function nearest_po2(value) end
--- @param value float
--- @param length float
--- @return float
function pingpong(value, length) end
function randomize() end
--- @return int
function randi() end
--- @return float
function randf() end
--- @param from int
--- @param to int
--- @return int
function randi_range(from, to) end
--- @param from float
--- @param to float
--- @return float
function randf_range(from, to) end
--- @param mean float
--- @param deviation float
--- @return float
function randfn(mean, deviation) end
--- @param base int
function seed(base) end
--- @param seed int
--- @return PackedInt64Array
function rand_from_seed(seed) end
--- @param obj any
--- @return any
function weakref(obj) end
--- @param variant any
--- @param type int
--- @return any
function type_convert(variant, type) end
--- @param arg1 any
--- @return String
function str(arg1, ...) end
--- @param error int
--- @return String
function error_string(error) end
--- @param type int
--- @return String
function type_string(type) end
--- @param arg1 any
function print(arg1, ...) end
--- @param arg1 any
function print_rich(arg1, ...) end
--- @param arg1 any
function printerr(arg1, ...) end
--- @param arg1 any
function printt(arg1, ...) end
--- @param arg1 any
function prints(arg1, ...) end
--- @param arg1 any
function printraw(arg1, ...) end
--- @param arg1 any
function print_verbose(arg1, ...) end
--- @param arg1 any
function push_error(arg1, ...) end
--- @param arg1 any
function push_warning(arg1, ...) end
--- @param variable any
--- @return String
function var_to_str(variable) end
--- @param string String
--- @return any
function str_to_var(string) end
--- @param variable any
--- @return PackedByteArray
function var_to_bytes(variable) end
--- @param bytes PackedByteArray
--- @return any
function bytes_to_var(bytes) end
--- @param variable any
--- @return PackedByteArray
function var_to_bytes_with_objects(variable) end
--- @param bytes PackedByteArray
--- @return any
function bytes_to_var_with_objects(bytes) end
--- @param variable any
--- @return int
function hash(variable) end
--- @param instance_id int
--- @return Object
function instance_from_id(instance_id) end
--- @param id int
--- @return bool
function is_instance_id_valid(id) end
--- @param instance any
--- @return bool
function is_instance_valid(instance) end
--- @return int
function rid_allocate_id() end
--- @param base int
--- @return RID
function rid_from_int64(base) end
--- @param a any
--- @param b any
--- @return bool
function is_same(a, b) end

View File

@@ -0,0 +1,146 @@
# Copyright (C) 2026 Gil Barbosa Reis.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the “Software”), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
@tool
extends Node
@onready var _output: RichTextLabel = $Output
@onready var _input: LineEdit = $Footer/Input
@onready var _history_popup: PopupMenu = $Header/HistoryButton.get_popup()
var _lua: LuaState
var _history = PackedStringArray()
var _current_history = 0
func _ready():
_history_popup.about_to_popup.connect(_on_history_popup_about_to_popup)
_history_popup.id_pressed.connect(_on_history_popup_id_pressed)
reset()
func reset():
_lua = LuaState.new()
_lua.open_libraries()
_lua.registry.print = _printn
_lua.globals.package.path = ProjectSettings.get_setting_with_override("lua_gdextension/lua_script_language/package_path")
_lua.globals.package.cpath = ProjectSettings.get_setting_with_override("lua_gdextension/lua_script_language/package_c_path")
_lua.load_string(r"""
local tab_size = ...
local indent = string.rep(' ', tab_size)
print = function(...)
local args = {...}
for i = 1, #args do
args[i] = tostring(args[i])
end
debug.getregistry().print(table.concat(args, indent))
end
""").invoke(_output.tab_size)
_history.clear()
_current_history = 0
clear()
func do_string(text: String):
text = text.strip_edges()
if text.is_empty():
return
_history.append(text)
_current_history = _history.size()
_input.clear()
_printn(text)
# support for "= value" idiom from Lua 5.1 REPL
text.trim_prefix("=")
var result = _lua.do_string("return " + text)
if result is LuaError:
result = _lua.do_string(text)
if result is LuaError:
_print_error(result.message)
else:
_printn("Out[%d]: %s" % [_current_history, result])
_prompt()
func clear():
_output.clear()
_prompt()
func set_history(index: int):
if index < 0 or index >= _history.size():
return
_current_history = index
var text = _history[index]
_input.text = text
_input.caret_column = text.length()
func _prompt():
_print("\nIn [%d]: " % [_current_history + 1])
func _print(msg: String):
self._output.add_text(msg)
func _printn(msg: String):
_print(msg)
_print("\n")
func _print_error(msg: String):
var color: Color = EditorInterface.get_editor_settings().get_setting("text_editor/theme/highlighting/brace_mismatch_color")
self._output.append_text("[color=%s]%s[/color]\n" % [color.to_html(), msg.replace("[", "[lb]")])
func _on_history_popup_about_to_popup():
_history_popup.clear()
for line in _history:
_history_popup.add_item(line)
func _on_history_popup_id_pressed(id: int):
set_history(id)
func _on_input_text_submitted(new_text: String):
do_string(new_text)
func _on_run_button_pressed():
do_string(_input.text)
func _on_input_gui_input(event: InputEvent):
var key_event = event as InputEventKey
if not key_event or not key_event.pressed:
return
if key_event.keycode == KEY_UP:
set_history(_current_history - 1)
get_viewport().set_input_as_handled()
elif key_event.keycode == KEY_DOWN:
set_history(_current_history + 1)
get_viewport().set_input_as_handled()

View File

@@ -0,0 +1 @@
uid://bjod0yq2efea8

View File

@@ -0,0 +1,59 @@
[gd_scene load_steps=2 format=3 uid="uid://4lq5s4lnqg8c"]
[ext_resource type="Script" uid="uid://bjod0yq2efea8" path="res://addons/lua-gdextension/lua_repl.gd" id="1_gf8ka"]
[node name="LuaRepl" type="VBoxContainer"]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_gf8ka")
[node name="Header" type="HBoxContainer" parent="."]
layout_mode = 2
[node name="Title" type="Label" parent="Header"]
layout_mode = 2
size_flags_horizontal = 3
text = "Lua REPL"
[node name="HistoryButton" type="MenuButton" parent="Header"]
layout_mode = 2
text = "History"
flat = false
[node name="ResetButton" type="Button" parent="Header"]
layout_mode = 2
tooltip_text = "Reset the Lua environment and REPL history"
text = "Reset"
[node name="ClearButton" type="Button" parent="Header"]
layout_mode = 2
tooltip_text = "Clear the output text"
text = "Clear"
[node name="Output" type="RichTextLabel" parent="."]
layout_mode = 2
size_flags_vertical = 3
focus_mode = 2
scroll_following = true
selection_enabled = true
[node name="Footer" type="HBoxContainer" parent="."]
layout_mode = 2
[node name="Input" type="LineEdit" parent="Footer"]
layout_mode = 2
size_flags_horizontal = 3
keep_editing_on_text_submit = true
[node name="RunButton" type="Button" parent="Footer"]
layout_mode = 2
text = "Run"
[connection signal="pressed" from="Header/ResetButton" to="." method="reset"]
[connection signal="pressed" from="Header/ClearButton" to="." method="clear"]
[connection signal="gui_input" from="Footer/Input" to="." method="_on_input_gui_input"]
[connection signal="text_submitted" from="Footer/Input" to="." method="_on_input_text_submitted"]
[connection signal="pressed" from="Footer/RunButton" to="." method="_on_run_button_pressed"]

View File

@@ -0,0 +1,45 @@
[configuration]
entry_symbol = "luagdextension_entrypoint"
compatibility_minimum = "4.4"
reloadable = true
[libraries]
macos.debug = "build/libluagdextension.macos.template_debug.universal.dylib"
macos.release = "build/libluagdextension.macos.template_release.universal.dylib"
ios.debug = "build/libluagdextension.ios.template_debug.universal.xcframework"
ios.release = "build/libluagdextension.ios.template_release.universal.xcframework"
windows.debug.x86_32 = "build/libluagdextension.windows.template_debug.x86_32.dll"
windows.release.x86_32 = "build/libluagdextension.windows.template_release.x86_32.dll"
windows.debug.x86_64 = "build/libluagdextension.windows.template_debug.x86_64.dll"
windows.release.x86_64 = "build/libluagdextension.windows.template_release.x86_64.dll"
windows.debug.arm64 = "build/libluagdextension.windows.template_debug.arm64.dll"
windows.release.arm64 = "build/libluagdextension.windows.template_release.arm64.dll"
linux.debug.x86_32 = "build/libluagdextension.linux.template_debug.x86_32.so"
linux.release.x86_32 = "build/libluagdextension.linux.template_release.x86_32.so"
linux.debug.x86_64 = "build/libluagdextension.linux.template_debug.x86_64.so"
linux.release.x86_64 = "build/libluagdextension.linux.template_release.x86_64.so"
linux.debug.arm64 = "build/libluagdextension.linux.template_debug.arm64.so"
linux.release.arm64 = "build/libluagdextension.linux.template_release.arm64.so"
android.debug.x86_32 = "build/libluagdextension.android.template_debug.x86_32.so"
android.release.x86_32 = "build/libluagdextension.android.template_release.x86_32.so"
android.debug.x86_64 = "build/libluagdextension.android.template_debug.x86_64.so"
android.release.x86_64 = "build/libluagdextension.android.template_release.x86_64.so"
android.debug.arm32 = "build/libluagdextension.android.template_debug.arm32.so"
android.release.arm32 = "build/libluagdextension.android.template_release.arm32.so"
android.debug.arm64 = "build/libluagdextension.android.template_debug.arm64.so"
android.release.arm64 = "build/libluagdextension.android.template_release.arm64.so"
web.debug.threads.wasm32 = "build/libluagdextension.web.template_debug.wasm32.wasm"
web.release.threads.wasm32 = "build/libluagdextension.web.template_release.wasm32.wasm"
web.debug.wasm32 = "build/libluagdextension.web.template_debug.wasm32.nothreads.wasm"
web.release.wasm32 = "build/libluagdextension.web.template_release.wasm32.nothreads.wasm"
[icons]
LuaScript = "LuaScript_icon.svg"
[dependencies]
ios.debug = {
"build/libgodot-cpp.ios.template_debug.universal.xcframework": ""
}
ios.release = {
"build/libgodot-cpp.ios.template_release.universal.xcframework": ""
}

View File

@@ -0,0 +1 @@
uid://d3k6wyksykaj2

View File

@@ -0,0 +1,7 @@
[plugin]
name="Lua GDExtension"
description="Tools for Lua GDExtension: REPL tab"
author="gilzoide"
version="0.7.0"
script="plugin.gd"

View File

@@ -0,0 +1,37 @@
# Copyright (C) 2026 Gil Barbosa Reis.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the “Software”), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
@tool
extends EditorPlugin
var _lua_repl: Control
func _enter_tree():
_lua_repl = preload("lua_repl.tscn").instantiate()
add_control_to_bottom_panel(_lua_repl, "Lua REPL")
func _exit_tree():
if _lua_repl:
remove_control_from_bottom_panel(_lua_repl)
_lua_repl.queue_free()
_lua_repl = null

View File

@@ -0,0 +1 @@
uid://cwp2hwkpbitgx