From c38d5eca7091fc7f0206ed0c746622022b2ae508 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Mon, 10 Sep 2018 23:11:08 -0400 Subject: Added documentation Also added treeview guielemnt Also added ifilesystem guielement Also added io library --- src/client/lua_api/gui/iguilabel.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/client/lua_api/gui/iguilabel.cpp') diff --git a/src/client/lua_api/gui/iguilabel.cpp b/src/client/lua_api/gui/iguilabel.cpp index 92611b2..336f81c 100644 --- a/src/client/lua_api/gui/iguilabel.cpp +++ b/src/client/lua_api/gui/iguilabel.cpp @@ -17,12 +17,24 @@ extern "C" { #include "../../callbackhandeler.hpp" #include +/*** +@module gui +*/ using namespace irr; using namespace gui; extern IrrlichtDevice* device; -//gui.newguilabel({{sx,sy},{ex,ey}},"text"[,parent]) :: {guielement} +/*** +@function newlabel() +Creates a new label to display text. +@tparam rect pos The position of the label, reletive to the upper-left of it's +parent element, or the root window if parent is nil. +@tparam string text The text to display on this label. +@tparam ?iguielement parent The parent element of the button. +@treturn iguilabel The label element +*/ +//gui.newlabel({{sx,sy},{ex,ey}},"text"[,parent]) :: {guielement} static int newiguilabel(lua_State* L){ printf("Createing label!\n"); int nargs = lua_gettop(L); @@ -36,8 +48,9 @@ static int newiguilabel(lua_State* L){ const char* text = lua_tostring(L,-1);//{{sx,sy},{ex,ey}},"text" int bls = strlen(text); - wchar_t* text_w = (wchar_t*)malloc(sizeof(wchar_t)*bls); + wchar_t* text_w = (wchar_t*)malloc((sizeof(wchar_t)*bls) + 1);//+1 for null mbstowcs(text_w,text,bls); + text_w[bls] = L'\0'; lua_pop(L,1);//{{sx,sy},{ex,ey}} long sx, sy, ex, ey; -- cgit v1.2.3-70-g09d2