commit 1242692f6f1542cf74078dd1d5b5f35b169d718b Author: Marrub Date: Wed Feb 7 13:30:04 2018 +0000 diff --git a/.md b/.md new file mode 100644 index 0000000..7a652fc --- /dev/null +++ b/.md @@ -0,0 +1,44 @@ +Top-level +========= + +A ZScript file can have one of several things at the top level of the file: + +- Class definitions +- Structure definitions +- Enumeration definitions +- Constant definitions +- Include directives + +Class definitions +================= + +A class definition starts with a class header, followed by an opening brace, class data and a closing brace. Alternatively, you can follow the class header with a semicolon and the rest of the file will be considered class data. + +Class headers +------------- + +The class header is formed as such: + +```cs + class Name [: BaseClass] [Class flags...] +``` + +Class flags include: + +| Flag | Description | +| --------------------- | --- | +| abstract | Cannot be instantiated with new(). | +| native | Class is from the engine. | +| ui | Has UI scope. | +| play | Has Play scope. | +| replaces ReplaceClass | Replaces ReplaceClass with this class. Only works on objects which are descendants of Actor. | +| version("ver") | Restricted to version . | + +Example usages: + +```cs + class MyCoolObject play // automatically inherits Object + class MyCoolThinker : Thinker // inherits Thinker + class MyCoolActor : Actor replaces OtherActor + class MyCoolInterface abstract // can only be inherited +``` \ No newline at end of file