-
Notifications
You must be signed in to change notification settings - Fork 0
Interface
There is one last missing puzzle piece before you can start using all key command features.
Since we love interfaces and GML does not natively support anything similar we implemented something close to intefaces in RichJSON.
Recommendation: Check out the raptor Interface wiki, and then come back to this page.
Just like with Constructors, RichJSON provides two types of Interfaces:
1. Normal Interface
Called instantly when RichJSON is resolved. (e.g. via file_read_struct or rich_json_apply)
2. Late Apply Interface
Called later during Late Applying.
mem: no implementation
key (normal): { "key;MyInterface1, MyInterface2, ... <interfaces>": { ... } }
key (late): { "key;;MyInterface1, MyInterface2, ... <interfaces>": { ... } }
interface signs: ; | ;;
separator: ,
function ILoggable() constructor {
ctor {
__log_string = undefined;
}
get_log_string = function() {
if (__log_string == undefined)
__log_string = $"{MY_CLASS_NAME} {some_variable} {some_status}";
return __log_string;
}
}
{
"interface_struct;ILoggable": {}
}Note
The interface and the ctor function implemented everything as specified
{
"interface_struct": {
"__log_string": undefined,
"get_log_string": function() {
if (__log_string == undefined)
__log_string = $"{MY_CLASS_NAME} {some_variable} {some_status}";
return __log_string;
}
}
}Author’s Recommendation: next read Advanced Key Syntax
Back to Repo ● Wiki Home
Copyright © coldrock.games