diff --git a/src/gui/lua/Makefile.am b/src/gui/lua/Makefile.am
index 6b99ec4ce..05a3b91a8 100644
--- a/src/gui/lua/Makefile.am
+++ b/src/gui/lua/Makefile.am
@@ -37,6 +37,7 @@ libneutrino_gui_lua_a_SOURCES = \
lua_menue.cpp \
lua_messagebox.cpp \
lua_misc.cpp \
+ lua_stringinput.cpp \
lua_threads.cpp \
lua_threads_copy.cpp \
lua_threads_functions.cpp \
diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h
index 5c47c47e2..b5e974561 100644
--- a/src/gui/lua/lua_api_version.h
+++ b/src/gui/lua/lua_api_version.h
@@ -4,4 +4,4 @@
* to luainstance.h changes
*/
#define LUA_API_VERSION_MAJOR 1
-#define LUA_API_VERSION_MINOR 55
+#define LUA_API_VERSION_MINOR 56
diff --git a/src/gui/lua/lua_stringinput.cpp b/src/gui/lua/lua_stringinput.cpp
new file mode 100644
index 000000000..e61264b50
--- /dev/null
+++ b/src/gui/lua/lua_stringinput.cpp
@@ -0,0 +1,106 @@
+/*
+ * lua stringinput
+ *
+ * (C) 2016 Sven Hoefer (svenhoefer)
+ * (C) 2016 M. Liebmann (micha-bbg)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include "luainstance.h"
+#include "lua_stringinput.h"
+
+CLuaInstStringInput* CLuaInstStringInput::getInstance()
+{
+ static CLuaInstStringInput* LuaInstStringInput = NULL;
+
+ if (!LuaInstStringInput)
+ LuaInstStringInput = new CLuaInstStringInput();
+ return LuaInstStringInput;
+}
+
+void CLuaInstStringInput::StringInputRegister(lua_State *L)
+{
+ luaL_Reg meth[] = {
+ { "exec", CLuaInstStringInput::StringInputExec },
+ { NULL, NULL }
+ };
+
+ luaL_newmetatable(L, "stringinput");
+ luaL_setfuncs(L, meth, 0);
+ lua_pushvalue(L, -1);
+ lua_setfield(L, -1, "__index");
+ lua_setglobal(L, "stringinput");
+}
+
+/*
+ local return_value = stringinput.exec{
+ caption="Title",
+ value="value",
+ icon="settings",
+ valid_chars="0123456789",
+ size=4
+ }
+*/
+int CLuaInstStringInput::StringInputExec(lua_State *L)
+{
+ lua_assert(lua_istable(L,1));
+
+ std::string name;
+ tableLookup(L, "name", name) || tableLookup(L, "title", name) || tableLookup(L, "caption", name);
+
+ std::string value;
+ tableLookup(L, "value", value);
+
+ lua_Integer size = 30;
+ tableLookup(L, "size", size);
+
+ // TODO: Locales?
+
+ std::string valid_chars = "abcdefghijklmnopqrstuvwxyz0123456789!\"§$%&/()=?-.@,_: ";
+ tableLookup(L, "valid_chars", valid_chars);
+
+ // TODO: CChangeObserver?
+
+ std::string icon = std::string(NEUTRINO_ICON_INFO);
+ tableLookup(L, "icon", icon);
+
+ lua_Integer sms = 0;
+ tableLookup(L, "sms", sms);
+
+ CStringInput *i;
+ if (sms)
+ i = new CStringInputSMS(name, &value, size,
+ NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, valid_chars.c_str(), NULL, icon.c_str());
+ else
+ i = new CStringInput(name, &value, size,
+ NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, valid_chars.c_str(), NULL, icon.c_str());
+ i->exec(NULL, "");
+ delete i;
+
+ lua_pushstring(L, value.c_str());
+
+ return 1;
+}
diff --git a/src/gui/lua/lua_stringinput.h b/src/gui/lua/lua_stringinput.h
new file mode 100644
index 000000000..c49ad7dc0
--- /dev/null
+++ b/src/gui/lua/lua_stringinput.h
@@ -0,0 +1,44 @@
+/*
+ * lua stringinput
+ *
+ * (C) 2016 Sven Hoefer (svenhoefer)
+ * (C) 2016 M. Liebmann (micha-bbg)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef _LUASTRINGINPUT_H
+#define _LUASTRINGINPUT_H
+
+class CLuaStringInput
+{
+ public:
+ CStringInput *b;
+ CLuaStringInput();
+ ~CLuaStringInput();
+};
+
+class CLuaInstStringInput
+{
+ public:
+ CLuaInstStringInput() {};
+ ~CLuaInstStringInput() {};
+ static CLuaInstStringInput* getInstance();
+ static void StringInputRegister(lua_State *L);
+
+ private:
+ static int StringInputExec(lua_State *L);
+};
+
+#endif //_LUASTRINGINPUT_H
diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp
index ad5ca34e8..a21cac683 100644
--- a/src/gui/lua/luainstance.cpp
+++ b/src/gui/lua/luainstance.cpp
@@ -49,6 +49,7 @@
#include "lua_menue.h"
#include "lua_messagebox.h"
#include "lua_misc.h"
+#include "lua_stringinput.h"
#include "lua_threads.h"
#include "lua_video.h"
@@ -626,6 +627,7 @@ void LuaInstRegisterFunctions(lua_State *L, bool fromThreads/*=false*/)
CLuaInstHintbox::getInstance()->HintboxRegister(L);
CLuaInstMenu::getInstance()->MenuRegister(L);
CLuaInstMessagebox::getInstance()->MessageboxRegister(L);
+ CLuaInstStringInput::getInstance()->StringInputRegister(L);
CLuaInstMisc::getInstance()->LuaMiscRegister(L);
CLuaInstVideo::getInstance()->LuaVideoRegister(L);
if (!fromThreads)