GameApi 28
Library used by GameApi Builder tool
Loading...
Searching...
No Matches
ChaiScript Language Object Model Reference

ChaiScript has an object system built in, for types defined within the ChaiScript system.

attr Rectangle::height
attr Rectangle::width
def Rectangle::Rectangle() { this.height = 10; this.width = 20 }
def Rectangle::area() { this.height * this.width }
var rect = Rectangle()
rect.height = 30
print(rect.area())
void print(const VoxFrame &f)
Definition GameApi.cc:22580
line height
Definition meshpage.php:3536
Boxed_Value var(T &&t)
Creates a Boxed_Value. If the object passed in is a value type, it is copied. If it is a pointer,...
Definition boxed_value.hpp:387

Since ChaiScript 5.4.0 it has been possible to use the "class" keyword to simplify this code.

class Rectangle {
attr height
attr width
def Rectangle() { this.height = 10; this.width = 20 }
def area() { this.height * this.width }
}
var rect = Rectangle()
rect.height = 30
print(rect.area())
See also
attr
def