natiny.resource.save

Lua
natiny.resource.save(resource, path) -> ok

Writes a resource's bytes to a file, replacing an existing file at that path.

Parameters

Name Type Description
resource number Resource handle
path string Where to write it; an existing file is overwritten

Returns

Type Description
boolean true when every byte was written

Example

Lua
local ok = natiny.resource.save(resource, "save.json")

Notes

  • On web, the path is in Emscripten's virtual filesystem and normally persists only for the current page session.