natiny.resource.mount
Lua
natiny.resource.mount(path [, key]) -> ok
Adds a folder to the top of the resource search stack. Paths loaded after the
call are resolved from inside that folder.
Parameters
| Name |
Type |
Default |
Description |
path |
string |
|
Non-empty folder path, absolute or relative to the process working directory |
key |
string |
"" |
Passphrase for an encrypted pack; an empty string reads unencrypted packs and is ignored for loose files |
Returns
| Type |
Description |
boolean |
true when the folder is on the stack; false for an invalid path, an allocation failure or an unreadable index.pack, including with a wrong key |
Example
Lua
local natiny = require("natiny")
if not natiny.resource.mount("dlc/winter", "a passphrase") then
error("cannot mount winter DLC")
end
local hero = natiny.resource.load("textures/hero.png")