s&
About
The Project
info
About s&box
map
Roadmap
monitoring
Metrics
Engine startup and usage numbers
Updates
newspaper
Latest News
published_with_changes
Changes
Release-by-release changelog
Games
Browse Games
Discover Games
gamejams
voting
Game Jam III
Ends
Fri 25 Sep
Theme
One More Round
Voting is open. Play the entries and pick the winner.
£
50,000
prizepool
View the jam
Workshop
Playable
sports_esports
Games
Standalone games and gamemodes
Assets
landscape
Maps
view_in_ar
Models
texture
Materials
apparel
Clothing
apps
Everything
Every asset type in one list
Forum
Learn
Documentation
rocket_launch
Getting Started
docs
Documentation
api
API Reference
Resources
school
Tutorials
manage_search
Code Search
Get s&box
Sign in with Steam
Api
Classes
Script
chevron_left
Classes
class
Script
Properties
data_object
LastError
Methods
functions
Compile
functions
HasArgument
functions
Run
functions
RunAndReturn
functions
SetArgument
functions
With
Script
A reusable script created by Sandbox.Game.Scripting. Arguments expire after each invocation; local variables are fresh each run. Use sequentially on the owning context's thread.
class
Sandbox
.
sealed
Sandbox.Engine
data_object
Properties
1
LastError
ScriptError
The most recent failure, or null after a successful invocation.
functions
Methods
6
Compile
(
)
bool
Checks that the script compiles with its supplied arguments without executing it. Arguments remain available for the next Run. Failure sets LastError.
HasArgument
(
name
)
bool
Whether this script references a named external argument. Use before supplying optional host inputs. Names are case sensitive; locals do not count as external arguments.
Run
(
instructionLimit
)
bool
Runs the script, returning false and setting LastError on failure.
RunAndReturn
(
instructionLimit
)
T
Runs the script and reads its result. Returns default on failure or when no value is returned. An incompatible return type is reported through LastError.
SetArgument
(
name
,
value
)
Supplies a named input for the next invocation only. Unknown names and changes during execution are API usage errors. Supply every input needed to bind host member calls before running.
With
(
name
,
value
)
ScriptInvocation`1
Creates a stack-only invocation with a temporary argument. Chain With to supply more arguments, then call Run or Compile. Names must be referenced by the script; repeated names replace earlier values.
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.