aboutsummaryrefslogtreecommitdiff
path: root/doc/lua_api.txt
diff options
context:
space:
mode:
authorJonathon Anderson <anderjon@umail.iu.edu>2013-04-11 13:23:38 -0500
committerkwolekr <kwolekr@minetest.net>2013-04-18 02:14:33 -0400
commit49f6e347f01f72e8854308d5a54aaae337489555 (patch)
tree232ed6de19e0671f34040b2705ffc6ce766e9e37 /doc/lua_api.txt
parent1f42479e0cad7d93ed9ef1a6f68a995c80e0b178 (diff)
downloadminetest-49f6e347f01f72e8854308d5a54aaae337489555.tar.gz
minetest-49f6e347f01f72e8854308d5a54aaae337489555.tar.bz2
minetest-49f6e347f01f72e8854308d5a54aaae337489555.zip
Lua HUD
Diffstat (limited to 'doc/lua_api.txt')
-rw-r--r--doc/lua_api.txt32
1 files changed, 31 insertions, 1 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index b29c50379..d4d078e27 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -1379,7 +1379,20 @@ Player-only: (no-op for other objects)
modifies per-player walking speed, jump height, and gravity.
Values default to 1 and act as offsets to the physics settings
in minetest.conf. nil will keep the current setting.
-
+- hud_add(id, hud definition)
+ ^ id is used for later reference
+ ^ If this id has already been used, it will reset its drawform
+- hud_rm(id): remove an id from the lua hud
+- hud_change(id, stat, value): change a value of a previously added element
+ ^ stat/table key: 0/position, 1/name, 2/scale, 3/text, 4/number,
+ ^ 5/item, 6/dir
+- hud_get_next_id(): get the next available id for a hud element
+- hud_lock_next_bar(right): add a non-conflicting statbar
+ ^ if right, will claim spot on right side, rather then left
+ ^ returns element id on success, false otherwise
+- hud_unlock_bar(id): remove a non-conflicting statbar
+ ^ id is the value returned by calling hud_lock_next_bar()
+
InvRef: Reference to an inventory
methods:
- is_empty(listname): return true if list is empty
@@ -1802,3 +1815,20 @@ Detached inventory callbacks
^ No return value
}
+HUD Definition (hud_add)
+{
+ type = "I", -- One of "I"(image), "S"(statbar),
+ ^ "T"(text), "i"(inv)
+ position = {x=0.5, y=0.5}, -- Left corner position
+ name = "<name>",
+ scale = {x=2, y=2},
+ text = "<text>",
+ ^ Used as texture name for statbars and images, and as list name
+ ^ for inv
+ number = 2,
+ ^ Used as stat for statbar, and as # of items for inv
+ item = 3, -- Selected item in inv. 0 -> no item selected
+ dir = 0,
+ ^ dir/inv direction: 0/left-right, 1/right-left,
+ ^ 2/top-bottom, 3/bottom-top
+}