Documentation
¶
Overview ¶
Package vm is responsible for the interop between legacy NoxScript VM and new NS runtime.
Index ¶
- func SetRuntime(r Implementation)
- type Func
- type Game
- type Implementation
- type Value
- func (v Value) Float() float32
- func (v Value) Int() int
- func (v Value) Object() ns3.ObjectID
- func (v Value) ObjectGroup() ns3.ObjectGroupID
- func (v Value) String() string
- func (v Value) Wall() ns3.WallID
- func (v Value) WallGroup() ns3.WallGroupID
- func (v Value) Waypoint() ns3.WaypointID
- func (v Value) WaypointGroup() ns3.WaypointGroupID
- type Var
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetRuntime ¶
func SetRuntime(r Implementation)
SetRuntime is used by the script host to bind runtime for the script package. Scripts must not call this functions.
Types ¶
type Func ¶
type Func struct {
// contains filtered or unexported fields
}
Func is a reference to a legacy NoxScript function.
func (*Func) Local ¶
Local returns a reference to a local function variable in legacy NoxScript.
Local function variables are static in NoxScript, they are not reset after the call. Because of this, they are frequently used to keep state between the calls.
Accessing these variables is similar to Global: var0 in function Foo can be accessed with vm.FuncPtr("Foo").Local(0).
type Game ¶
type Game interface {
// NoxScriptVM returns implementation of NoxScript VM.
NoxScriptVM() Implementation
}
Game is an optional interface for the engine that exposes NoxScript runtime.
type Implementation ¶
type Implementation interface {
NewString(s string) uint32
GetString(val uint32) string
GetFuncInd(fnc string) int
GetFuncVar(fnc int, vari int) uint32
SetFuncVar(fnc int, vari int, val uint32)
CallFunc(fnc int, args []uint32) uint32
}
Implementation of the script VM. Only used in the engine itself.
func Runtime ¶
func Runtime() Implementation
Runtime returns implementation of all the accessible functions as an interface.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value is an untyped value, as stored in NoxScript runtime.
func (Value) ObjectGroup ¶
func (v Value) ObjectGroup() ns3.ObjectGroupID
ObjectGroup returns NoxScript value as object group.
func (Value) WallGroup ¶
func (v Value) WallGroup() ns3.WallGroupID
WallGroup returns NoxScript value as wall group.
func (Value) Waypoint ¶
func (v Value) Waypoint() ns3.WaypointID
Waypoint returns NoxScript value as waypoint.
func (Value) WaypointGroup ¶
func (v Value) WaypointGroup() ns3.WaypointGroupID
WaypointGroup returns NoxScript value as waypoint group.
type Var ¶
type Var struct {
// contains filtered or unexported fields
}
Var is a reference to a legacy NoxScript variable.
func FuncVar ¶
FuncVar returns a reference to a local function variable in legacy NoxScript.
It's a shortcut for vm.FuncPtr(fnc).Local(vari). See Func.Local for details.