diff options
| author | Alexander <alex@cogarr.net> | 2019-10-27 17:25:16 -0400 |
|---|---|---|
| committer | Alexander <alex@cogarr.net> | 2019-10-27 17:25:16 -0400 |
| commit | 0d2de2ba9c616862d7881f089382db772d034f89 (patch) | |
| tree | 5fc58b63c593e2ac17f3353b50318c299f643390 /src/client/lua_api/phys | |
| parent | c9db55cdc2f69c3dc7aefabe0cc828a64e377024 (diff) | |
| download | brokengine-0d2de2ba9c616862d7881f089382db772d034f89.tar.gz brokengine-0d2de2ba9c616862d7881f089382db772d034f89.tar.bz2 brokengine-0d2de2ba9c616862d7881f089382db772d034f89.zip | |
Various updates
Diffstat (limited to 'src/client/lua_api/phys')
| -rw-r--r-- | src/client/lua_api/phys/cbcharactercontroller.cpp | 2 | ||||
| -rw-r--r-- | src/client/lua_api/phys/cbphysbox.cpp | 13 | ||||
| -rw-r--r-- | src/client/lua_api/phys/cbphysmodel.cpp | 12 | ||||
| -rw-r--r-- | src/client/lua_api/phys/cbphysmodel.hpp | 2 |
4 files changed, 18 insertions, 11 deletions
diff --git a/src/client/lua_api/phys/cbcharactercontroller.cpp b/src/client/lua_api/phys/cbcharactercontroller.cpp index 6a6da96..16ad1ad 100644 --- a/src/client/lua_api/phys/cbcharactercontroller.cpp +++ b/src/client/lua_api/phys/cbcharactercontroller.cpp @@ -115,6 +115,4 @@ void cbcharactercontroller_register(lua_State* L){ //printf("When registering physbox, new() is %p\n",newcbphysbox); //printf("setpos is %p\n",cbphyssetpos); - lua_pop(L,1); - } diff --git a/src/client/lua_api/phys/cbphysbox.cpp b/src/client/lua_api/phys/cbphysbox.cpp index 3c0f97d..e675a04 100644 --- a/src/client/lua_api/phys/cbphysbox.cpp +++ b/src/client/lua_api/phys/cbphysbox.cpp @@ -2,6 +2,7 @@ #include <stdio.h> #include <stdlib.h> #include <list> +#include <assert.h> extern "C" { #include <lua.h> #include <lauxlib.h> @@ -163,12 +164,15 @@ static const luaL_reg cbphysbox_m[] = { }; void cbphysbox_register(lua_State* L){ + assert(lua_gettop(L) == 0); bphysbox_register(L);// + assert(lua_gettop(L) == 0); lua_getglobal(L,"phys");//{} lua_pushcfunction(L,newcbphysbox);//{},newcbphysbox() - lua_setfield(L,-2,"newcphysbox");//{} + lua_setfield(L,-2,"newphysbox");//{phys} lua_pop(L,1);// + assert(lua_gettop(L) == 0); luaL_getmetatable(L,"phys.physbox");//phys.physbox lua_newtable(L);//phys.physbox,{} @@ -176,15 +180,14 @@ void cbphysbox_register(lua_State* L){ luaL_register(L,NULL,brigidbody_m); luaL_register(L,NULL,igeneric_m); luaL_register(L,NULL,cbphysbox_m);//phys.physbox,{} - lua_pushstring(L,"rigidbody"); - lua_setfield(L,-2,"type"); + lua_pushstring(L,"rigidbody");//phys.physbox,{},"rigidbody" + lua_setfield(L,-2,"type");//phys.physbox,{} lua_setfield(L,-2,"__index");//phys.physbox lua_pop(L,1); - //printf("When registering physbox, new() is %p\n",newcbphysbox); //printf("setpos is %p\n",cbphyssetpos); - lua_pop(L,1); + assert(lua_gettop(L) == 0); } diff --git a/src/client/lua_api/phys/cbphysmodel.cpp b/src/client/lua_api/phys/cbphysmodel.cpp index ac27288..ae2559e 100644 --- a/src/client/lua_api/phys/cbphysmodel.cpp +++ b/src/client/lua_api/phys/cbphysmodel.cpp @@ -6,6 +6,7 @@ #include <map> #include <functional> #include <list> +#include <assert.h> extern "C" { #include <lua.h> #include <lauxlib.h> @@ -260,9 +261,12 @@ static const luaL_reg bphysmodel_m[] = { {0, 0}, }; -int cbphysmodel_register(lua_State* L){ +void cbphysmodel_register(lua_State* L){ + assert(lua_gettop(L) == 0); bphysmodel_register(L); + assert(lua_gettop(L) == 0); + assert(lua_gettop(L) == 0); luaL_getmetatable(L,"phys.physmodel");//{physmodel_m} lua_getfield(L,-1,"__index");//{physmodel_m},{} luaL_register(L,NULL,igeneric_m); //Inherit all the things to do with scene nodes @@ -270,9 +274,11 @@ int cbphysmodel_register(lua_State* L){ luaL_register(L,NULL,brigidbody_m);//Add rigidbody things luaL_register(L,NULL,bphysmodel_m);//anything specific? lua_pop(L,2); + assert(lua_gettop(L) == 0); + assert(lua_gettop(L) == 0); lua_getglobal(L,"phys"); luaL_register(L,NULL,bphysmodel_f); - - return 1; + lua_pop(L,1); + assert(lua_gettop(L) == 0); } diff --git a/src/client/lua_api/phys/cbphysmodel.hpp b/src/client/lua_api/phys/cbphysmodel.hpp index 5ea42a8..d8495d2 100644 --- a/src/client/lua_api/phys/cbphysmodel.hpp +++ b/src/client/lua_api/phys/cbphysmodel.hpp @@ -8,5 +8,5 @@ extern "C" { } #include <irrlicht.h> -int cbphysmodel_register(lua_State* L); +void cbphysmodel_register(lua_State* L); #endif |
