pull/1/head
Marrub 2018-02-07 13:30:04 +00:00 committed by GitHub
commit 1242692f6f
1 changed files with 44 additions and 0 deletions

44
.md Normal file
View File

@ -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 <ver>. |
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
```