Coding language differences
(Redirected from Coding Language Differences)
Jump to navigation
Jump to search
Note: This feature is for ZScript only. |
When programming ZScript, it's often recommended practicing a different coding language to become familiar with how things work. However, every language has its own quirks that make it different from the next one. Here is a list of identified coding languages that possess many similarities to ZScript and their differences, including (but not limited to) syntax.
From C(++)
- No dereference or address variable pointers (* and & respectively) -- only by pointers (i.e. target.health)
- 'new' syntax is <ClassName> thing = new("<ClassName>");
- NOTE: Actor classes and all inheriting from it cannot be created with the 'new' keyword, only the Spawn function or related.
- 'auto' is known as 'let'
- 'this' is known as 'self'
- 'readonly' keyword available
From Java
- 'boolean' is known as 'bool'
- No 'public' keyword
From Lua
ZScript has multi-return and named arguments from Lua, with the following differences:
- Multi-return values must be encased in square brackets: [val1, val2] = A_MyFunctionWithTwoReturns();
- Named arguments must be used after the required parameters, and must be in order according to the function's specifications.