Skip to content

Class ScriptNatives

Namespace: Apogee.Scripting
Assembly: Apogee.Scripting.dll

Methods of a class that are written by hand against the Luau stack because they take tables, functions or variable shapes that the registry cannot describe (the ECS calls on World). A native sees the stack as a method does: the object at index 1, then the arguments; it returns the number of results it pushed, and throws a for a script error. Each comes with its .d.luau declaration, so the definitions cannot lack one.

public static class ScriptNatives

Inheritance

object ← ScriptNatives

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Methods

Register(string, string, delegate*<State*, int>, string)

Adds a native method to the class registered under className. Does nothing when it is there already (a VM registers them each time).

public static void Register(string className, string name, delegate*<State*, int> body, string declaration)

Parameters

className string

name string

body delegate*<State*, int>

declaration string

RegisterLibrary(string, string, delegate*<State*, int>, string, string?)

Adds a function to the global table library (xml.decode), which scripts see in every VM. Like the native methods it reads the stack itself and comes with its declaration. Does nothing when it is there already.

public static void RegisterLibrary(string library, string name, delegate*<State*, int> body, string type, string? doc = null)

Parameters

library string

name string

body delegate*<State*, int>

type string

doc string?