1
0
Fork 0
mirror of https://github.com/ctruLua/ctruLua.git synced 2025-10-27 16:39:29 +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

@ -22,6 +22,9 @@ static const struct luaL_Reg qtm_methods[];
/***
Initialize the QTM module.
@function init
@treturn[1] boolean `true` if everything went fine
@treturn[2] boolean `false` in case of error
@treturn[2] integer error code
*/
static int qtm_init(lua_State *L) {
Result ret = qtmInit();
@ -121,8 +124,10 @@ Convert QTM coordinates to screen coordinates
@tparam number coordinates index
@tparam[opt=400] number screenWidth specify a screen width
@tparam[opt=320] number screenHeight specify a screen height
@treturn number screen X coordinate
@treturn number screen Y coordinate
@treturn[1] number screen X coordinate
@treturn[1] number screen Y coordinate
@treturn[2] nil in case of error
@treturn[2] string error message
*/
static int qtm_convertCoordToScreen(lua_State *L) {
qtm_userdata *info = luaL_checkudata(L, 1, "LQTM");
@ -130,7 +135,7 @@ static int qtm_convertCoordToScreen(lua_State *L) {
index = index - 1; // Lua index begins at 1
if (index > 3 || index < 0) {
lua_pushnil(L);
lua_pushnil(L);
lua_pushstring(L, "Index must be between 1 and 3");
return 2;
}
float screenWidth = luaL_optnumber(L, 3, 400.0f);