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

The ctr.news library should now be bug-free !

Untested, but checked 3 times with citra, and everything matches the doc.
Warning: there is no check of any kind, so don't put weird stuff as arguments.
This commit is contained in:
Firew0lf 2015-12-24 23:58:16 +01:00
parent bebfa8b72d
commit fe894820a2

View file

@ -10,6 +10,7 @@ The `news` module.
#include <lua.h>
#include <lauxlib.h>
#include <stdlib.h>
#include <string.h>
/***
@ -23,7 +24,7 @@ static int news_init(lua_State *L) {
}
/***
Send a notification to the user. WIP, do not use !!!
Send a notification to the user. Should work now.
@function notification
@tparam string title title of the notification
@tparam[opt=nil] string message message of the notification, or nil for no message
@ -40,8 +41,8 @@ static int news_notification(lua_State *L) {
if (lua_isboolean(L, 4))
jpeg = lua_toboolean(L, 4);
const u16* cTitle = 0;
const u16* cMessage = 0;
const u16* cTitle = malloc(strlen(title)*sizeof(u16));
const u16* cMessage = malloc(strlen(message)*sizeof(u16));
u32 titleLength, messageLength;
titleLength = (u32) utf8_to_utf16((uint16_t*)cTitle, (uint8_t*)title, strlen(title));