ChaiScript is the first and only scripting language designed from the ground up with C++ compatibility in mind. It is an ECMAScript-inspired, embedded functional-like language.
ChaiScript is licensed under the BSD license.
ChaiScript is the first and only scripting language designed from the ground up with C++ compatibility in mind. It is an ECMAScript-inspired, embedded functional-like language.
ChaiScript is licensed under the BSD license.
Introduction
The Vector, in some languages also called an 'array', is a simple container of values of any type. In ChaiScript, "Vector" is an exposing of the std::vector<>.
Creating Vectors
There are two main ways to create a Vector. The first is to call the "Vector()" function, like so:
var v = Vector()
You may also use a shorter syntax, which is probably familiar to users of other scripting languages:
var v = []
Using the shorter syntax, you can also give initial values for the Vector:
var v = [4, "bob", 3.5]
Using Vectors
The easiest way to read or write to Vectors is through direct access:
var v = [4, 5, 6] v[1] = 10 print(v[1])
Additional function/methods are also available: