Update README.md
This commit is contained in:
parent
595192df36
commit
8a29a6a96c
@ -56,3 +56,8 @@ var result = vfiler.load_supported("file.cff")
|
||||
|
||||
This is extremely powerful since you have no need to modify the source code for VFileAccess nor its dependency scripts. You can freely pass your own importers or integrate other plugins for importers, as long as the import function you use takes a `PackedByteArray` and returns something of value.
|
||||
|
||||
# Writing custom virtual accessors.
|
||||
|
||||
VFileAccess does not use inheritance, but rather a factory and first class functions, to override behavior. This allows for customizing and compounding behavior very easily. Although the code as of writing in `create_vfs.gd` are long and staircased, they can pretty easily be split out separately or even faked to appear like subclasses if you really wanted to. Context for specific VFileAccess instances are accessible by the amazingly named `get_stuff()` which will return a Variant. This acts as a closure holding data such as ZIPReader/ZIPWriter. You can return whatever context for your loader you see fit. It is preferable you don't actually rely on this though, as part of why VFileAccess is so universally usable is because you don't need to know or care about context at all. Since there is no inheritance, there is no need to worry about what specific subclass of VFileAccess is.
|
||||
|
||||
You best actually read the VFileAccess definition and skim the creator functions to figure out how to implement your own. Remember that there is no need to add your own creators or importers directly to VFileAccess's scripts, because it is designed to let you define those elsewhere in your project. This lets you update these scripts with less hassle of reimplementing your own changes.
|
Loading…
Reference in New Issue
Block a user