aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/phys/butil.cpp
blob: 6319688d5f43b918a75a915d6c2e4a3f5de50f20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <stdio.h>

extern "C" {
  #include <lua.h>
  #include <lauxlib.h>
  #include <lualib.h>
}

#include <btBulletDynamicsCommon.h>

#include "butil.hpp"

btVector3 lua_popbtvector(lua_State* L,int pos){
	f32 p[3];
	
	for(int i = 0; i < 3; i++){
		lua_pushnumber(L,i+1);
		lua_gettable(L,pos);
		p[i] = (f32) lua_tonumber(L,-1);
		lua_pop(L,1);
	}
	
	printf("Found vector (%f,%f,%f)\n",p[0],p[1],p[2]);
	
	return btVector3(p[0],p[1],p[2]);
}