aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/video/smaterial.cpp
diff options
context:
space:
mode:
authorAlexander Pickering <alex@cogarr.net>2018-06-30 16:15:05 -0600
committerAlexander Pickering <alex@cogarr.net>2018-06-30 16:15:05 -0600
commited58795eaf03bdee0b1fae8d05ce5b86d17549f7 (patch)
tree065092f3e95bf74fdba541f6c5f7504757487d3d /src/client/lua_api/video/smaterial.cpp
parent45e61c74802af739736d33c82f27596b45987eee (diff)
downloadbrokengine-ed58795eaf03bdee0b1fae8d05ce5b86d17549f7.tar.gz
brokengine-ed58795eaf03bdee0b1fae8d05ce5b86d17549f7.tar.bz2
brokengine-ed58795eaf03bdee0b1fae8d05ce5b86d17549f7.zip
Warning-less build
All compile warning for -Wall have been fixed
Diffstat (limited to 'src/client/lua_api/video/smaterial.cpp')
-rw-r--r--src/client/lua_api/video/smaterial.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/client/lua_api/video/smaterial.cpp b/src/client/lua_api/video/smaterial.cpp
index c72d4ca..2ef7053 100644
--- a/src/client/lua_api/video/smaterial.cpp
+++ b/src/client/lua_api/video/smaterial.cpp
@@ -14,22 +14,27 @@ using namespace irr::video;
int newsmaterial(lua_State* L){
SMaterial* mat = new SMaterial();
- lua_pushlightuserdata(L,mat);//ud_smaterial
+ lua_newtable(L);//{}
+ lua_pushlightuserdata(L,mat);//{},ud_smaterial
+ lua_setfield(L,-2,"smaterial");//{smaterial}
- luaL_getmetatable(L,"smaterial");//ud_smaterial,{m_smaterial}
- lua_setmetatable(L,-2);//ud_smaterial
+ luaL_getmetatable(L,"video.smaterial");//{smaterial},{m_smaterial}
+ lua_setmetatable(L,-2);//{smaterial}
return 1;
}
-//setMaterial(self,int_num,{ITexture texture})
+//setTexture(self,int_num,{ITexture texture})
int setTexture(lua_State* L){
+ lua_getfield(L,-1,"texture");
ITexture* tex = (ITexture*)lua_touserdata(L,-1);
- lua_pop(L,1);
+ lua_pop(L,2);
double num = lua_tonumber(L,-1);
lua_pop(L,1);
+ lua_getfield(L,-1,"smaterial");
SMaterial* self = (SMaterial*)lua_touserdata(L,-1);
- lua_pop(L,1);
+ lua_pop(L,2);
+ self->setTexture(num,tex);
return 0;
}
@@ -43,7 +48,7 @@ static const luaL_reg smaterial_m[] = {
void smaterial_register(lua_State* L){
//Add globals dealing with material flags
- luaL_newmetatable(L,"smaterial");//{m_smaterial}
+ luaL_newmetatable(L,"video.smaterial");//{m_smaterial}
lua_newtable(L);//{m_smaterial},{}
luaL_register(L,NULL,smaterial_m);//{m_smaterial},{smaterial}