![]() |
naev 0.12.5
|
Handles files. More...
#include "physfsrwops.h"#include "nlua_file.h"#include "nluadef.h"#include "physfs.h"
Go to the source code of this file.
Functions | |
| static int | fileL_gc (lua_State *L) |
| Frees a file. | |
| static int | fileL_eq (lua_State *L) |
| Compares two files to see if they are the same. | |
| static int | fileL_new (lua_State *L) |
| Opens a new file. | |
| static int | fileL_open (lua_State *L) |
| Opens a File object. | |
| static int | fileL_close (lua_State *L) |
| Closes a file. | |
| static int | fileL_read (lua_State *L) |
| Reads from an open file. | |
| static int | fileL_write (lua_State *L) |
| Reads from an open file. | |
| static int | fileL_seek (lua_State *L) |
| Seeks in an open file. | |
| static int | fileL_name (lua_State *L) |
| Gets the name of a file object. | |
| static int | fileL_mode (lua_State *L) |
| Gets the mode a file is currently in. | |
| static int | fileL_size (lua_State *L) |
| Gets the size of a file (must be open). | |
| static int | fileL_isopen (lua_State *L) |
| Checks to see if a file is open. | |
| static int | fileL_filetype (lua_State *L) |
| Checks to see the filetype of a path. | |
| static int | fileL_mkdir (lua_State *L) |
| Makes a directory. | |
| static int | fileL_enumerate (lua_State *L) |
| Returns a list of files and subdirectories of a directory. | |
| static int | fileL_remove (lua_State *L) |
| Removes a file or directory. | |
| int | nlua_loadFile (nlua_env env) |
| Loads the file library. | |
| LuaFile_t * | lua_tofile (lua_State *L, int ind) |
| Lua bindings to interact with files. | |
| LuaFile_t * | luaL_checkfile (lua_State *L, int ind) |
| Gets file at index or raises error if there is no file at index. | |
| LuaFile_t * | lua_pushfile (lua_State *L, LuaFile_t file) |
| Pushes a file on the stack. | |
| int | lua_isfile (lua_State *L, int ind) |
| Checks to see if ind is a file. | |
Variables | |
| static const luaL_Reg | fileL_methods [] |
Handles files.
Definition in file nlua_file.c.
|
static |
Closes a file.
Lua function parameter: File file File to close. Lua return parameter: true on success.
| L | Lua State |
Lua function: close
Definition at line 231 of file nlua_file.c.
|
static |
Returns a list of files and subdirectories of a directory.
Lua function parameter: string dir Name of the directory to check. Lua return parameter: table Table containing all the names (strings) of the subdirectories and files in the directory.
| L | Lua State |
Lua function: enumerate
Definition at line 439 of file nlua_file.c.
|
static |
Compares two files to see if they are the same.
Lua function parameter: File f1 File 1 to compare. Lua function parameter: File f2 File 2 to compare. Lua return parameter: boolean true if both files are the same.
| L | Lua State |
Lua function: __eq
Definition at line 163 of file nlua_file.c.
|
static |
Checks to see the filetype of a path.
Lua function parameter: string path Path to check to see what type it is. Lua return parameter: string What type of file it is or nil if doesn't exist.
| L | Lua State |
Lua function: filetype
Definition at line 393 of file nlua_file.c.
|
static |
Frees a file.
Lua function parameter: File file File to free.
| L | Lua State |
Lua function: __gc
Definition at line 145 of file nlua_file.c.
|
static |
Checks to see if a file is open.
Lua function parameter: File file File to check to see if is open. Lua return parameter: boolean true if the file is open, false otherwise.
| L | Lua State |
Lua function: isOpen
Definition at line 379 of file nlua_file.c.
|
static |
Makes a directory.
Lua function parameter: string dir Name of the directory to make. Lua return parameter: boolean True on success.
| L | Lua State |
Lua function: mkdir
Definition at line 419 of file nlua_file.c.
|
static |
Gets the mode a file is currently in.
Lua function parameter: File file File to get mode of. Lua return parameter: string Mode of the file (either 'c', 'w', 'r', or 'a')
| L | Lua State |
Lua function: getMode
Definition at line 351 of file nlua_file.c.
|
static |
Gets the name of a file object.
Lua function parameter: File file File object to get name of. Lua return parameter: string Name of the file object.
| L | Lua State |
Lua function: getFilename
Definition at line 337 of file nlua_file.c.
|
static |
Opens a new file.
Lua function parameter: string path Path to open. Lua return parameter: File New file object.
| L | Lua State |
Lua function: new
Definition at line 179 of file nlua_file.c.
|
static |
Opens a File object.
Lua function parameter: File File object to open. Lua function parameter:[opt="r"] mode Mode to open the file in (should be 'r', 'w', or 'a'). Lua return parameter: boolean true on success, false and an error string on failure.
| L | Lua State |
Lua function: open
Definition at line 200 of file nlua_file.c.
|
static |
Reads from an open file.
Lua function parameter: File file File to read from. Lua function parameter:[opt] number bytes Number of bytes to read or all if ommitted. Lua return parameter: string Read data. Lua return parameter: number Number of bytes actually read.
| L | Lua State |
Lua function: read
Definition at line 252 of file nlua_file.c.
|
static |
Removes a file or directory.
Lua function parameter: string path Name of the path to remove. Lua return parameter: boolean True on success.
| L | Lua State |
Lua function: remove
Definition at line 465 of file nlua_file.c.
|
static |
Seeks in an open file.
Lua function parameter: File file File to seek in. Lua function parameter: number pos Position to seek to (from start of file). Lua return parameter: boolean true on success.
| L | Lua State |
Lua function: seek
Definition at line 313 of file nlua_file.c.
|
static |
Gets the size of a file (must be open).
Lua function parameter: File file File to get the size of. Lua return parameter: number Size of the file.
| L | Lua State |
Lua function: getSize
Definition at line 365 of file nlua_file.c.
|
static |
Reads from an open file.
Lua function parameter: File file File to write to. Lua function parameter: string data Data to write. Lua function parameter:[opt] number bytes Number of bytes to write.
| L | Lua State |
Lua function: write
Definition at line 282 of file nlua_file.c.
| int lua_isfile | ( | lua_State * | L, |
| int | ind ) |
Checks to see if ind is a file.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 123 of file nlua_file.c.
Pushes a file on the stack.
| L | Lua state to push file into. |
| file | File to push. |
Definition at line 108 of file nlua_file.c.
| LuaFile_t * lua_tofile | ( | lua_State * | L, |
| int | ind ) |
Lua bindings to interact with files.
Lua module: file
Gets file at index.
| L | Lua state to get file from. |
| ind | Index position to find the file. |
Definition at line 83 of file nlua_file.c.
| LuaFile_t * luaL_checkfile | ( | lua_State * | L, |
| int | ind ) |
Gets file at index or raises error if there is no file at index.
| L | Lua state to get file from. |
| ind | Index position to find file. |
Definition at line 94 of file nlua_file.c.
| int nlua_loadFile | ( | nlua_env | env | ) |
Loads the file library.
| env | Environment to load file library into. |
Definition at line 63 of file nlua_file.c.
|
static |
File metatable methods.
Definition at line 38 of file nlua_file.c.