Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: probablycorey/wax
base: 95c2a41cac
...
head fork: probablycorey/wax
compare: bba422996f
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 6 files changed
  • 0 commit comments
  • 2 contributors
View
2  .gitignore
@@ -2,3 +2,5 @@ build/
*.pbxuser
*.perspectivev3
wax.framework
+xcuserdata
+.DS_Store
View
10 lib/wax.m
@@ -29,11 +29,13 @@
static int exitApp(lua_State *L);
static int objcDebug(lua_State *L);
+static lua_State *currentL;
lua_State *wax_currentLuaState() {
- static lua_State *L;
- if (!L) L = lua_open();
- return L;
+ if (!currentL)
+ currentL = lua_open();
+
+ return currentL;
}
void uncaughtExceptionHandler(NSException *e) {
@@ -152,7 +154,9 @@ void wax_startWithServer() {
}
void wax_end() {
+ [wax_gc stop];
lua_close(wax_currentLuaState());
+ currentL = 0;
}
static void addGlobals(lua_State *L) {
View
5 lib/wax_class.m
@@ -73,10 +73,7 @@ static int __call(lua_State *L) {
const char *className = luaL_checkstring(L, 2);
Class klass = objc_getClass(className);
- if (klass) { // Class should not already exist!
- luaL_error(L, "Trying to create a class named '%s', but one already exists.", className);
- }
- else {
+ if (!klass) {
Class superClass;
if (lua_isuserdata(L, 3)) {
wax_instance_userdata *instanceUserdata = (wax_instance_userdata *)luaL_checkudata(L, 3, WAX_INSTANCE_METATABLE_NAME);
View
1  lib/wax_gc.h
@@ -14,6 +14,7 @@
}
+ (void)start;
++ (void)stop;
+ (void)cleanupUnusedObject;
@end
View
10 lib/wax_gc.m
@@ -19,8 +19,16 @@
@implementation wax_gc
+static NSTimer* timer = nil;
+
+ (void)start {
- [NSTimer scheduledTimerWithTimeInterval:WAX_GC_TIMEOUT target:self selector:@selector(cleanupUnusedObject) userInfo:nil repeats:YES];
+ [timer invalidate];
+ timer = [NSTimer scheduledTimerWithTimeInterval:WAX_GC_TIMEOUT target:self selector:@selector(cleanupUnusedObject) userInfo:nil repeats:YES];
+}
+
++ (void)stop {
+ [timer invalidate];
+ timer = nil;
}
+ (void)cleanupUnusedObject {
View
2  tools/Framework/Framework.xcodeproj/project.pbxproj
@@ -526,7 +526,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
- shellScript = "\"$PROJECT_DIR/wax/lib/build-scripts/compile-stdlib.sh\"";
+ shellScript = "#\"$PROJECT_DIR/wax/lib/build-scripts/compile-stdlib.sh\"";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

No commit comments for this range

Something went wrong with that request. Please try again.