# Module: `nupp.resources` Owning wrappers for Lua's file handles. `io.open` hands back a borrowed handle, which means nothing has to close it and nothing complains when nobody does. These are the same calls annotated as owners, so the checker knows a handle must be discharged and lexical cleanup can do it — on fallthrough, on error, and on structured control flow alike. See `docs/ownership.md`. ## Functions ### `resources.openFile` _function_ Opens a file and transfers responsibility for closing it to the caller. The returned handle closes automatically at its lexical boundary. ```nupp function resources.openFile(path: string, mode: string?): LuaFile ``` #### Arguments | Name | Type | Description | | --- | --- | --- | | `path` | `string` | the path of the file to open | | `mode` | `string?` | the Lua file mode; omitted uses the Lua default | #### Returns | Type | Description | | --- | --- | | `LuaFile` | the open file handle, owned by the caller | #### Raises - when the file cannot be opened ### `resources.openProcess` _function_ Starts a process and transfers responsibility for closing its pipe to the caller. The returned handle closes automatically at its lexical boundary. ```nupp function resources.openProcess(command: string, mode: string?): LuaFile ``` #### Arguments | Name | Type | Description | | --- | --- | --- | | `command` | `string` | the shell command to run | | `mode` | `string?` | the Lua pipe mode; omitted uses the Lua default | #### Returns | Type | Description | | --- | --- | | `LuaFile` | the process pipe, owned by the caller | #### Raises - when the process pipe cannot be opened ### `resources.temporaryFile` _function_ Creates a temporary file owned by the caller. The returned handle closes automatically at its lexical boundary. ```nupp function resources.temporaryFile(): LuaFile ``` #### Returns | Type | Description | | --- | --- | | `LuaFile` | the open temporary file handle, owned by the caller | #### Raises - when the temporary file cannot be created