1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-28 00:39:30 +00:00

Renamed item.fileSize to item.size in fs.list() return value, enabled 3D in the editor, added a lot of missing documentation

For the return values, I followed this rule: if the fuction returns true on success, it should return false, error on error; for every other case it should return nil, error on error.

Also, who doesn't want to edit code in 3D ? The line depth depends on the indentation level.
This commit is contained in:
Reuh 2016-04-22 13:42:59 +02:00
parent 2b7d37304d
commit 358b68c643
13 changed files with 143 additions and 72 deletions

View file

@ -20,20 +20,23 @@ u32 bufferSize = 0;
Initialize the mic module.
@function init
@tparam[opt=0x50000] number bufferSize size of the buffer (must be a multiple of 0x1000)
@treturn[1] boolean `true` if everything went fine
@treturn[2] boolean `false` in case of error
@treturn[2] integer/string error code/message
*/
static int mic_init(lua_State *L) {
bufferSize = luaL_optinteger(L, 1, 0x50000);
buff = memalign(0x1000, bufferSize);
if (buff == NULL) {
lua_pushnil(L);
lua_pushboolean(L, false);
lua_pushstring(L, "Couldn't allocate buffer");
return 2;
}
Result ret = micInit(buff, bufferSize);
if (ret) {
free(buff);
lua_pushnil(L);
lua_pushboolean(L, false);
lua_pushinteger(L, ret);
return 2;
}