natiny.resource.get_data
natiny.resource.get_data(resource) -> bytes
Returns the raw bytes of a loaded resource.
Parameters
| Name | Type | Description |
|---|---|---|
resource |
number |
Resource handle from natiny.resource.load |
Returns
| Type | Description |
|---|---|
string |
Resource bytes (binary-safe Lua string) |
Example
local res = natiny.resource.load("data/file.bin")
local bytes = natiny.resource.get_data(res)
Notes
- Lua returns a separate binary-safe string copy. It remains valid if the resource is later destroyed.