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

Changes spaces to tabs; Fixed a warning on compilation.

This commit is contained in:
Firew0lf 2015-08-18 11:41:39 +02:00
parent 8ea3cb766f
commit 8f42c4f7ab
2 changed files with 29 additions and 27 deletions

View file

@ -11,6 +11,8 @@
#define BOOT_FILE "/ctruLua/main.lua" #define BOOT_FILE "/ctruLua/main.lua"
LUALIB_API void luaL_openlibs (lua_State *L);
int load_ctr_lib(lua_State *L); int load_ctr_lib(lua_State *L);
// Display an error // Display an error

View file

@ -6,47 +6,47 @@
#include <lauxlib.h> #include <lauxlib.h>
static int news_init(lua_State *L) { static int news_init(lua_State *L) {
newsInit(); newsInit();
return 0; return 0;
} }
static int news_notification(lua_State *L) { static int news_notification(lua_State *L) {
const char *title = luaL_checkstring(L, 1); const char *title = luaL_checkstring(L, 1);
const char *message = luaL_checkstring(L, 2); const char *message = luaL_checkstring(L, 2);
const void *imageData = luaL_checkstring(L, 3); const void *imageData = luaL_checkstring(L, 3);
bool jpeg = false; bool jpeg = false;
if (lua_isboolean(L, 4)) if (lua_isboolean(L, 4))
jpeg = lua_toboolean(L, 4); jpeg = lua_toboolean(L, 4);
const u16* cTitle = 0; const u16* cTitle = 0;
const u16* cMessage = 0; const u16* cMessage = 0;
u32 titleLength, messageLength, imageDataLength = 0; u32 titleLength, messageLength, imageDataLength = 0;
titleLength = (u32) utf8_to_utf16((uint16_t*)cTitle, (uint8_t*)title, sizeof(title)); titleLength = (u32) utf8_to_utf16((uint16_t*)cTitle, (uint8_t*)title, sizeof(title));
messageLength = (u32) utf8_to_utf16((uint16_t*)cMessage, (uint8_t*)message, sizeof(message)); messageLength = (u32) utf8_to_utf16((uint16_t*)cMessage, (uint8_t*)message, sizeof(message));
NEWSU_AddNotification(cTitle, titleLength, cMessage, messageLength, imageData, imageDataLength, jpeg); NEWSU_AddNotification(cTitle, titleLength, cMessage, messageLength, imageData, imageDataLength, jpeg);
return 0; return 0;
} }
static int news_shutdown(lua_State *L) { static int news_shutdown(lua_State *L) {
newsExit(); newsExit();
return 0; return 0;
} }
static const struct luaL_Reg news_lib[] = { static const struct luaL_Reg news_lib[] = {
{"init", news_init }, {"init", news_init },
{"notification", news_notification}, {"notification", news_notification},
{"shutdown", news_shutdown }, {"shutdown", news_shutdown },
{NULL, NULL} {NULL, NULL}
}; };
int luaopen_news_lib(lua_State *L) { int luaopen_news_lib(lua_State *L) {
luaL_newlib(L, news_lib); luaL_newlib(L, news_lib);
return 1; return 1;
} }
void load_news_lib(lua_State *L) { void load_news_lib(lua_State *L) {