aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/phys/cbphysbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/lua_api/phys/cbphysbox.cpp')
-rw-r--r--src/client/lua_api/phys/cbphysbox.cpp13
1 files changed, 8 insertions, 5 deletions
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);
}