mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-27 16:39:29 +00:00
Added the Tiago Dionizio's "lzlib", and modified it to be usable with ctrµLua.
Accessible with require("ctr.fs.lzlib"). I just added the file "lzlib.c" in the source/ directory, because it's much simpler to build.
https://github.com/LuaDist/lzlib for details and documentation.
This commit is contained in:
parent
070a0d698e
commit
22bcc3e2d5
3 changed files with 1072 additions and 4 deletions
17
source/fs.c
17
source/fs.c
|
|
@ -10,6 +10,8 @@
|
|||
Handle *fsuHandle;
|
||||
FS_archive sdmcArchive;
|
||||
|
||||
void load_lzlib(lua_State *L);
|
||||
|
||||
static int fs_list(lua_State *L) {
|
||||
const char *path = luaL_checkstring(L, 1);
|
||||
|
||||
|
|
@ -99,9 +101,20 @@ static const struct luaL_Reg fs_lib[] = {
|
|||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
// submodules
|
||||
struct { char *name; void (*load)(lua_State *L); void (*unload)(lua_State *L); } fs_libs[] = {
|
||||
{"zip", load_lzlib, NULL},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
int luaopen_fs_lib(lua_State *L) {
|
||||
luaL_newlib(L, fs_lib);
|
||||
|
||||
|
||||
for (int i = 0; fs_libs[i].name; i++) {
|
||||
fs_libs[i].load(L);
|
||||
lua_setfield(L, -2, fs_libs[i].name);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -121,4 +134,4 @@ void unload_fs_lib(lua_State *L) {
|
|||
FSUSER_CloseArchive(fsuHandle, &sdmcArchive);
|
||||
|
||||
fsExit();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue