mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-05 14:24:28 +00:00
.. | ||
animation | ||
character | ||
conversation | ||
dialogue | ||
event | ||
level | ||
notestyle | ||
song | ||
speaker | ||
stage | ||
BaseRegistry.hx | ||
DataError.hx | ||
DataParse.hx | ||
DataWrite.hx | ||
IRegistryEntry.hx | ||
README.md |
funkin.data
Data structures are parsed using json2object
, which uses macros to generate parser classes based on anonymous structures OR classes.
Parsing errors will be returned in parser.errors
. See json2object.Error
for an enumeration of possible parsing errors. If an error occurred, parser.value
will be null.
The properties of these anonymous structures can have their behavior changed with annotations:
@:optional
: The value is optional and will not throw a parsing error if it is not present in the JSON data.@:default("test")
: If the value is optional, this value will be used instead ofnull
. Replace"test"
with a value of the property's type.@:default(auto)
: If the value is an anonymous structure withjson2object
annotations, each field will be initialized to its default value.@:jignored
: This value will be ignored by the parser. Their presence will not be checked in the JSON data and their values will not be parsed.@:alias
: Choose the name the value will use in the JSON data to be separate from the property name. Useful if the desired name is a reserved word likepublic
.@:jcustomparse
: Provide a custom function for parsing from a JSON string into a value.- Functions must be of the signature
(hxjsonast.Json, String) -> T
, where the String is the property name andT
is the type of the property. hxjsonast.Json
contains apos
and avalue
, withvalue
being an enum: https://nadako.github.io/hxjsonast/hxjsonast/JsonValue.html- Errors thrown in this function will cause a parsing error (
CustomFunctionException
) along with a position! - Make sure to provide the FULLY QUALIFIED path to the custom function.
- Functions must be of the signature
@:jcustomwrite
: Provide a custom function for serializing the property into a string for storage as JSON.- Functions must be of the signature
(T) -> String
, whereT
is the type of the property.
- Functions must be of the signature