website is under construction
Standard Library

Ghost

Methods

ghost.abort()

Creates a new runtime error and outputs the specified message. If the passed value is null no runtime error is generated.

ghost.abort("A critical error was encountered. Aborting.")

// expected output: A critical error was encountered. Aborting.

ghost.execute()

Executes Ghost code represented as a string. The string representation can include variables and properties of existing objects.

print(ghost.execute('2 + 2'))

// expected output: 4

ghost.extend()

Registers and executes a plugin compiled through Go, allowing the ability to dynamically extend Ghost with new native functionality. Plugins must be compiled against both the exact version of Ghost, and the version of Go used to compile Ghost.

Ghost VersionGo Version
1.0-beta.11.17.5

To compile a plugin with Go, use the -buildmode=plugin build flag:

$ go build -buildmode=plugin -o example.so main.go
ghost.extend('./example.so')

ghost.identifiers()

Returns a list of all identifieris within the current scope.

ghost.identifiers()

Properties

ghost.version

Returns the current version of Ghost.

ghost.version