natiny.resource.unmount

Lua
natiny.resource.unmount(path) -> ok

Takes a folder off the stack that natiny.resource.load and require read from, and frees the packs it had in memory. Names it was answering fall through to whatever is under it.

Parameters

Name Type Description
path string Folder to unmount, named as it was mounted

Returns

Type Description
boolean true when a mount was taken off, false when nothing was mounted under that name

Example

Lua
local natiny = require("natiny")

natiny.resource.mount("mods/hd-textures")
-- ... the player turns the mod off
natiny.resource.unmount("mods/hd-textures")

-- back to the folder underneath
local hero = natiny.resource.load("textures/hero.png")

Notes

  • The packs this mount had unpacked in memory are freed here, whether or not a resource is still standing on them.
  • An asynchronous load still waiting on this mount's packs fails, and its callback is told so on the next frame rather than left unanswered.