aboutsummaryrefslogtreecommitdiff
path: root/src/shared/lua_api/common.cpp
diff options
context:
space:
mode:
authorAlexander <alex@cogarr.net>2019-06-26 16:14:00 -0400
committerAlexander <alex@cogarr.net>2019-06-26 16:14:00 -0400
commitd5cd0c7b4425e25b11a1ceec154a5c752d508a42 (patch)
treeef50cd7d419bba30ee08f46c97232b1c8c68d2be /src/shared/lua_api/common.cpp
parent3d60e1432ec43ade4aa61b5a70dd6b8975417e9f (diff)
downloadbrokengine-d5cd0c7b4425e25b11a1ceec154a5c752d508a42.tar.gz
brokengine-d5cd0c7b4425e25b11a1ceec154a5c752d508a42.tar.bz2
brokengine-d5cd0c7b4425e25b11a1ceec154a5c752d508a42.zip
Major refactor of physics code
Move all the physics code into the shared directory, and fix the ghost objects (aabb only)
Diffstat (limited to 'src/shared/lua_api/common.cpp')
-rw-r--r--src/shared/lua_api/common.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/shared/lua_api/common.cpp b/src/shared/lua_api/common.cpp
index 1ee4b72..9b833fe 100644
--- a/src/shared/lua_api/common.cpp
+++ b/src/shared/lua_api/common.cpp
@@ -5,6 +5,7 @@ extern "C" {
#include <lualib.h>
}
+#include <stdlib.h>
#include "common.hpp"
//Expose things to the lua state
@@ -236,6 +237,9 @@ int popvector2i(lua_State* L, long* a, long* b){
return 0;
}
+//When crashy is enabled, errors that usually get caught by errfunc crash instead
+//Useful for testing
+bool crashy = false;
//errfunc("mssg",false)
int errfunc(lua_State *L){
printf("Error function called\n");
@@ -268,9 +272,18 @@ int errfunc(lua_State *L){
printf("--------------------------\n");
lua_call(L,1,0);//error,{debug}
lua_pop(L,1);
- printf("Returning");
+ printf("Returning:");
+ printf("crashy is %d", crashy);
+ if(crashy){
+ exit(-1);
+ }
return 1;
}
void pusherrorfunc(lua_State *L){
lua_pushcfunction(L,errfunc);
}
+int make_crashy(lua_State *L){
+ crashy = true;
+ printf("Setting crashy to %d\n",crashy);
+ return 0;
+}