diff options
Diffstat (limited to 'src/client/lua_api')
| -rw-r--r-- | src/client/lua_api/gui/iguibutton.cpp | 6 | ||||
| -rw-r--r-- | src/client/lua_api/load_video.cpp | 1 | ||||
| -rw-r--r-- | src/client/lua_api/phys/cbcharactercontroller.cpp | 9 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/client/lua_api/gui/iguibutton.cpp b/src/client/lua_api/gui/iguibutton.cpp index b8ff517..3d4580b 100644 --- a/src/client/lua_api/gui/iguibutton.cpp +++ b/src/client/lua_api/gui/iguibutton.cpp @@ -47,13 +47,17 @@ static int newiguibutton(lua_State* L){ //printf("Createing gui button!\n"); int nargs = lua_gettop(L); + if(nargs > 3 || nargs < 2){ + lua_pop(L,nargs); + lua_pushstring(L,"Incorrect number of arguments for gui.newbutton(rect,\"text\"[,parent])"); + lua_error(L); + } IGUIElement* parent = NULL; if(nargs == 3){ lua_getfield(L,-1,"guielement"); parent = (IGUIElement*)lua_touserdata(L,-1); lua_pop(L,2);//{{sx,sy},{ex,ey}},"text" } - const char* label_c = lua_tostring(L,-1);//{{sx,sy},{ex,ey}},"text" size_t label_c_len = strlen(label_c); wchar_t label_w[label_c_len + 1] = L""; diff --git a/src/client/lua_api/load_video.cpp b/src/client/lua_api/load_video.cpp index b3487ca..73be550 100644 --- a/src/client/lua_api/load_video.cpp +++ b/src/client/lua_api/load_video.cpp @@ -89,6 +89,7 @@ int draw3dline(lua_State* L){ popvector3d(L,&ex,&ey,&ez); popvector3d(L,&sx,&sy,&sz); + driver->setTransform(video::ETS_WORLD, core::IdentityMatrix); driver->draw3DLine(vector3df(sx,sy,sz),vector3df(ex,ey,ez),SColor(a,r,g,b)); return 0; diff --git a/src/client/lua_api/phys/cbcharactercontroller.cpp b/src/client/lua_api/phys/cbcharactercontroller.cpp index 16ad1ad..f93d01a 100644 --- a/src/client/lua_api/phys/cbcharactercontroller.cpp +++ b/src/client/lua_api/phys/cbcharactercontroller.cpp @@ -9,6 +9,7 @@ extern "C" { #include <btBulletDynamicsCommon.h> #include <BulletDynamics/Character/btKinematicCharacterController.h> +#include <BulletCollision/CollisionDispatch/btGhostObject.h> #include <irrlicht.h> #include "cbphysbox.hpp" #include "../scene/imesh.hpp" @@ -49,6 +50,7 @@ static int newcbcharactercontroller(lua_State* L){// ISceneNode* n = (ISceneNode*)lua_touserdata(L,-1);//ud_iscenenode lua_pop(L,1); + cc->getGhostObject()->setUserPointer(n); //cc->setUserPointer(n);//TODO: what does this break? lua_newtable(L);//{} @@ -56,6 +58,8 @@ static int newcbcharactercontroller(lua_State* L){// lua_setfield(L,-2,"character");//{} lua_pushlightuserdata(L,n);//{},ud_iscenenode lua_setfield(L,-2,"node");//{} + lua_pushstring(L,"character"); + lua_setfield(L,-2,"type"); luaL_getmetatable(L,"phys.charactercontroller");//{},{phys.charactercontroller} lua_setmetatable(L,-2);//{} @@ -102,12 +106,13 @@ void cbcharactercontroller_register(lua_State* L){ lua_setfield(L,-2,"newccharactercontroller");//{} lua_pop(L,1);// - + luaL_getmetatable(L,"phys.charactercontroller");//phys.physbox lua_newtable(L);//phys.physbox,{} - luaL_register(L,NULL,brigidbody_m); + //luaL_register(L,NULL,brigidbody_m); luaL_register(L,NULL,igeneric_m); luaL_register(L,NULL,cbcharactercontroller_m);//phys.physbox,{} + luaL_register(L,NULL,bcharactercontroller_m); lua_setfield(L,-2,"__index");//phys.physbox lua_pop(L,1); |
