aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/lua_api/gui/iguibutton.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/client/lua_api/gui/iguibutton.cpp b/src/client/lua_api/gui/iguibutton.cpp
index 999e667..ee5ac79 100644
--- a/src/client/lua_api/gui/iguibutton.cpp
+++ b/src/client/lua_api/gui/iguibutton.cpp
@@ -79,12 +79,30 @@ static int newiguibutton(lua_State* L){
return 1;
}
+/***
+Set the image of a button.
+@function iguibutton:setimage(tex)
+@tparam texture tex The texture to apply to this button.
+*/
+//setimage(self, itexture)
+int setimage_button(lua_State *L){
+ lua_getfield(L,-1,"texture");//{self},{image},image*
+ video::ITexture* tex = (video::ITexture*) lua_touserdata(L,-1);
+ lua_pop(L,2);//{self}
+ lua_getfield(L,-1,"guielement");//{self},iguielement*
+ IGUIButton *e = (IGUIButton*)lua_touserdata(L,-1);
+ lua_pop(L,2);//
+ e->setImage(tex);
+ return 0;
+}
+
static const luaL_Reg iguibutton_f[] = {
{"new", newiguibutton},
{0,0},
};
static const luaL_Reg iguibutton_m[] = {
+ {"setimage", setimage_button},
{0,0},
};