From 2c97dada7b9c7fedc511f1ecf012346c198d92f8 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Sat, 11 Aug 2018 08:17:13 -0400 Subject: Various updates Edit boxes can have their contents retreived Fixed a typo for edit box methods various updates to the net api --- src/client/lua_api/gui/iguieditbox.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/client/lua_api/gui/iguieditbox.cpp') diff --git a/src/client/lua_api/gui/iguieditbox.cpp b/src/client/lua_api/gui/iguieditbox.cpp index 7b79f34..1ceab1f 100644 --- a/src/client/lua_api/gui/iguieditbox.cpp +++ b/src/client/lua_api/gui/iguieditbox.cpp @@ -61,6 +61,19 @@ static int newiguieditbox(lua_State* L){ return 1; } +//{guieditbox}:getinput() +int getinputtext(lua_State* L){ + lua_getfield(L, -1, "guielement");//{guieditbox},ud_guielement + irr::gui::IGUIElement *el = (IGUIElement*)lua_touserdata(L,-1); + lua_pop(L,2);// + const wchar_t *t = el->getText(); + size_t strlen = wcslen(t); + char output[strlen]; + wcstombs(output,t,strlen); + lua_pushstring(L,output);//"str" + return 1; +} + static const luaL_reg iguieditbox_f[] = { {"neweditbox",newiguieditbox}, {0,0}, @@ -69,6 +82,7 @@ static const luaL_reg iguieditbox_f[] = { static const luaL_reg iguieditbox_m[] = { {"move", moveiguielement}, {"settext", setiguitext}, + {"getinput", getinputtext}, {"remove", removeiguielement}, {0,0}, }; -- cgit v1.2.3-70-g09d2