aboutsummaryrefslogtreecommitdiff
path: root/src/scriptapi.cpp
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-01-02 19:45:04 +0000
committerPerttu Ahola <celeron55@gmail.com>2013-01-02 20:59:37 +0200
commitda9707950e0f69d8a906572fc55f516277e057c4 (patch)
treec8991d2c8f650d0735e69ff93fc9ebe0b32b141c /src/scriptapi.cpp
parent36f03a7f4ae81e8735328a38c9415b6e7081c37c (diff)
downloadminetest-da9707950e0f69d8a906572fc55f516277e057c4.tar.gz
minetest-da9707950e0f69d8a906572fc55f516277e057c4.tar.bz2
minetest-da9707950e0f69d8a906572fc55f516277e057c4.zip
Add TOCLIENT_SHOW_FORMSPEC to display formspecs at client from lua
Diffstat (limited to 'src/scriptapi.cpp')
-rw-r--r--src/scriptapi.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index d086b7e51..83987fc9b 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -4899,6 +4899,21 @@ static int l_create_detached_inventory_raw(lua_State *L)
return 1;
}
+// create_detached_formspec_raw(name)
+static int l_show_formspec(lua_State *L)
+{
+ const char *playername = luaL_checkstring(L, 1);
+ const char *formspec = luaL_checkstring(L, 2);
+
+ if(get_server(L)->showFormspec(playername,formspec))
+ {
+ lua_pushboolean(L, true);
+ }else{
+ lua_pushboolean(L, false);
+ }
+ return 1;
+}
+
// get_dig_params(groups, tool_capabilities[, time_from_last_punch])
static int l_get_dig_params(lua_State *L)
{
@@ -5228,6 +5243,7 @@ static const struct luaL_Reg minetest_f [] = {
{"unban_player_or_ip", l_unban_player_of_ip},
{"get_inventory", l_get_inventory},
{"create_detached_inventory_raw", l_create_detached_inventory_raw},
+ {"show_formspec", l_show_formspec},
{"get_dig_params", l_get_dig_params},
{"get_hit_params", l_get_hit_params},
{"get_current_modname", l_get_current_modname},