YarnNativeCompiler
Wrapper for the bundled native Yarn Spinner compiler. Editor-only — used by the importer to compile .yarn files without requiring the ysc CLI tool or .NET runtime on the user's machine.
class_name YarnNativeCompiler
extends RefCountedInherits from RefCounted
#Constants
#NATIVE_BIN_DIR
const NATIVE_BIN_DIR = "res://addons/yarn_spinner/native/bin/"#NATIVE_BIN_NAMES
const NATIVE_BIN_NAMES = {"linux-arm64": "ysc-native-linux-arm64", "linux-x64": "ysc-native-linux-x64", "macos-universal": "ysc-native-macos-universal", "windows-arm64": "ysc-native-windows-arm64.exe", "windows-x64": "ysc-native-windows-x64.exe"}#Methods
#compile(Array[Dictionary], Array[Dictionary], int)
Compile Yarn source files using the native compiler. Input: array of dictionaries [{ "fileName": "X.yarn", "source": "..." }] declarations (optional): functions the game provides, so the compiler knows their types, as [{ name, parameters: [type, ...], returnType, variadicParameterType (optional), description (optional) }]. Types are "string", "number", "bool" or "any". Entries with a missing or "any" return type are ignored. Returns: Dictionary with: success: bool program: PackedByteArray (compiled protobuf, empty on error) compiler_failed: bool (the compiler could not run, as opposed to reporting errors) string_table: Dictionary { line_id: { text, nodeName, lineNumber, fileName, isImplicitTag, metadata } } declarations: Array of { name, type, isEnum, description, isInlineExpansion, sourceFileName, defaultValue } enums: Array of { name, description, rawType, cases: [{ name, description, value }] } diagnostics: Array of { message, severity, fileName, line, column, code }
static func compile(files: Array[Dictionary], declarations: Array[Dictionary] = [], language_version: int = 0) -> DictionaryParameters
filesArray[Dictionary]declarationsArray[Dictionary]language_versionint
Returns Dictionary
#get_native_bin_path()
Returns the path to the native compiler binary for this platform and architecture, or an empty string if there isn't one.
static func get_native_bin_path() -> StringReturns String
#is_available()
Returns true if the native compiler binary is available.
static func is_available() -> boolReturns bool
#tag_lines(Array[Dictionary], PackedStringArray, String)
static func tag_lines(files: Array[Dictionary], excluded_line_ids: PackedStringArray = PackedStringArray(), tagger: String = "random") -> DictionaryParameters
filesArray[Dictionary]excluded_line_idsPackedStringArraytaggerString
Returns Dictionary
Generated from Yarn Spinner for Godot GDScript 3.3.