Code Monkey home page Code Monkey logo

wax's People

Contributors

christosc avatar eraserhd avatar ethercrow avatar nuxlli avatar omniwheel avatar probablycorey avatar tmm1 avatar toastdriven avatar turbolent avatar zbyhoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wax's Issues

Protocol's methods are unavailable until conformsToProtocol is called

waxClass{"TestObject", NSObject, protocols={"TestProtocol"}}
function testMethod(self)
    return true
end
@protocol TestProtocol <NSObject>
- (id)test;
@end

id<TestProtocol> p = [[NSClassFromString(@"TestProtocol") alloc] init];
[p test];

Code above doesn't work (will crash with "unrecognized selector sent to instance ..."), but this code will work:

id<TestProtocol> p = [[NSClassFromString(@"TestProtocol") alloc] init];
[p conformsToProtocol:@protocol(TestProtocol)];
[p test];

Synchronous calls to wax.http.request

There is a flaw in the wax http library which manifests itself when wax.http.request is called synchronously. This note describes the issue and proposes a workaround.

Let's say the user takes some action which causes wax.http.request to be called synchronously. But before the first call to request has terminated, the user takes some other action that causes wax.http.request to be called again. In this situation, one of the calls can return spurious results. This is because the lua_State and stack is getting clobbered in between calls. Here's how:

wax.http.request does the following in synchronous mode: 1) creates and starts an http connection; 2) saves the lua_State object in the connection object; 3) starts the operation; and 4) spins in a loop waiting for the connection to complete, relinquishing time to the run loop on each iteration. When the http response arrives a completion handler in the connection object is called. This handler uses the saved Lua state (L) to push results on the argument stack of wax.http.request so they can be passed back to the caller.

Now a problem occurs when an external event causes the http.request to be called again while it has relinquished time on the run loop. The Lua state has been stashed away in the first connection object. It is in an indeterminate state, i.e., in the middle of a function call. When http.request is called again, wax uses this same state for the new procedure call, clobbering the state in the first connection. Wax assumes a single-threaded non-reentrant environment where at most one procedure invocation stack is active at a time. This allows wax to use a single Lua state for all invocations. But stashing away the Lua call state while in the midst of a function call in the connection breaks this assumption.

This suggests that we want an independent Lua state for each call to wax.http.request. The easiest way to do this is to create a coroutine and to issue the request on the coroutine. Here's a simple wrapper that does the job:

function http_sync_wrapper(arg)

    -- create a coroutine and call wax.http.request
    local co = coroutine.create(
        function() 
            local body, response = wax.http.request(arg)
            coroutine.yield(body, response)
        end
    )

    -- start the coroutine, wait for wax.http.request to complete
    local status, body, response = coroutine.resume(co)

    -- let coroutine terminate
    coroutine.resume(co)

    -- return to caller
    return body, response
end

The operation of the above function is simple. It calls http.request in the context of a new coroutine. This creates an independent Lua state that can be saved in the connection object. When the request completes the coroutine yields back to its caller. A reentrant synchronous call to wax.http.request will not interfere with other ongoing calls to the same function.

There are ways to fix the problem in the objective-c code but I wanted to avoid touching the low-level library if possible. Probably the best place to put this wrapper is in http.lua.

Note that while the existing design isn't necessarily a problem for asynchronous calls, saving the state of Lua stack frame after it has returned is perhaps not the best idea either. So it might be worthwhile to wrap all calls to wax.http.request--synchronous and asynchronous--in a coroutine.

wax crashes when calling method with a float parameter

This crashes with EXC_BAD_ACCESS:

[luaEntity onUpdateEveryFrame:delta];

delta is a float .. the call works perfectly fine if I wrap delta in an NSNumber object.

luaEntity is a ObjC class derived from ObjC class LuaObject
with wax_Class{"entity", "LuaEntity"} I created a subclass of LuaEntity to which this message is supposed to be sent. In case this makes any difference.

The call stack goes like this:
#0 0x019e9a60 in objc_msgSend
#1 0x000431ea in wax_fromInstance at wax_helpers.m:201
#2 0x0004306b in wax_fromObjc at wax_helpers.m:164
#3 0x00047b1c in pcallUserdata at wax_instance.m:576
#4 0x00047e82 in wax_id_call at wax_instance.m:627
#5 0x00003b6b in -[ScriptEntity update:] at ScriptEntity.m:62

The offending line where it crashes is the isKindOfClass line from this snippet:

void wax_fromInstance(lua_State *L, id instance) {
BEGIN_STACK_MODIFY(L)
if (instance) {
if ([instance isKindOfClass:[NSString class]]) {

I think what's going on is that wax assumes the float parameter to be an id which eventually leads to the crash (trying to send isKindOfClass to a float, ouch).

Run a lua script from the users Documents directory?

Hi there... Is it possible to run a lua script from the users documents directory?

Specifically, I think it'd be nice to be able to build an app where 99% of the lua code was located in the users document directory, so you could build the app as a generic lua engine, deploy it to the simulator, and then do all your dev work by simply modifying files in the Users document directory. In practice, I'd actually like to use a folder other than the documents directory, since that dir changes everytime an app is built and deployed to the simulator, but it's the same idea in practice.

I'm also aware that apple wouldn't let lua scripts be downloaded at runtime, but this would be super helpful for speeding up the development process (ie no more builds!)

Thanks

Unable to start interactive console for TwitterApp example

Specs: MacBook Snow Leopard, iOS 4.2

in the TwitterApp example, I placed the following line of code

function applicationDidFinishLaunching(self, application)
....
wax_startWithServer()
....
end

When I run in simulator debug mode, I get the following error message

Error calling 'applicationDidFinishLaunching:' on lua object '<AppDelegate: 0x6000e30>'
scripts/AppDelegate.lua:7: attempt to call field 'wax_startWithServer' (a nil value)
stack traceback:
[C]: in function 'wax_startWithServer'
scripts/AppDelegate.lua:7: in function <scripts/AppDelegate.lua:5>

Any thoughts on how to resolve the above error? Thanks in advance!

error in wax_sqlite_operations.m ?

there's probably a setting in my build config that i'm missing, but i couldn't for the life of me get wax to build in xcode 4 (i'm on lion, so the only way i'll get 3 to run is virtualized). it was complaining about a c99 issue with this line (154):
wax_copyObject(operationLuaState, L, 1);

commenting it out lets it build, but i'm guessing that i just broke the sqllite engine :)

when i switch to c89, ansi, or even gcc-c99, it also burped up errors.

perhaps there's another switch in the default build settings that i missed? man, i really wish that apple would make xcode 4 templates a bunch easier. i swear that i spend 2 hours trying to find just the right library and build combo to get any framework to compile a hello world these days.

Missing git semantic version tag

I want to add the CocoaPod support for this repo. But it does not have any semantic version tag (tag with message). Would you add tag to it?

# example
git tag -a 1.0.0 -m "Tag release 1.0.0"

Thanks!

wax.http.request introdution memory leaks

Hi,

We are using the wax in a project feed reader, as it does recursive HTTP requests (an average of 12 every 10 minutes), we shall find a memory leak in code wax.http.request.

The problem happens due to a quirk in the way NSURLConnection performs asynchronous requests. Briefly, the problem happens because of an extra retain it makes when it receives a message like: initWithRequest:delegate:startImmediately, as it needs to retain the delegate for the future answer this ends up confusing the gc of the wax.

A temporary solution was to execute a release in properties of wax_http_request class: nuxlli@5dbff70

This solution does not solve the whole problem, as an instance of wax_http_request still gets lost, but in our case has saved a lot of memory.
I believe in a refactory wax_http_request, so that the delegate is not the class itself, would be the best solution.

What do you think?

Everton

is it possible to patch for calling a c fucntion?

I have a oc object init like this:

 (id)init
{
    self = [super init];
    if (self) {
        RCTSetFatalHandler(^(NSError *ferror){
            //            NSLog(@"%@", ferror);
        });
    }
    return self;
}

RCTSetFatalHandler is a C function in other file,like:

void RCTSetFatalHandler(RCTFatalHandler fatalhandler)
{
  RCTCurrentFatalHandler = fatalhandler;
}

is it possible patch using wax like this:

function init(self)
    self = self.super:init();
    if  self~=nil then
        RCTSetFatalHandler(nil);
    end
    return self
end

How do I compile wax_stdlib about 64bit

My project is developmenting for more half a year in wax_hua,bug apple must support 64bit on 2015.02.01. but My project Does not support arm64 now. Now what should I do。and How do I compile wax_stdlib about 64bit。

Calls to ObjC functions with const pointer arguments fail

I'm calling this method from Lua:
self:setBackgroundColor{red = 0.1, green = 0.2, blue = 0.3, alpha = 1}

If the method is declared to take a const NSDictionary* like so the call fails:
-(void) setBackgroundColor:(const NSDictionary*)dict

Error calling 'onInit' on lua object '<Scene: 0x714d5d0>'
[string "waxClass{'Scene', ObjcScene};function ..."]:2: 
Unable to get type for Obj-C method argument with type description 'r@'

Declaring the method to take a non-const NSDictionary* works:
-(void) setBackgroundColor:(NSDictionary*)dict

In this case it's not tragic because I can just remove the const. But I imagine there may be methods in the iOS SDK or other 3rd party libraries taking const pointers where this would fail.

Looks like wax_copyToObjc needs a WAX_TYPE_CONST_ID switch case.

Impossible to restart wax

wax_end() function simply doesn't work.

For example, it doesn't stop GC timer, and after closing lua_State GC crashes the app on the next attempt to clean.

Twitter example fails due changed API

Twitter example fails (empty screen) due changed twitter API

solution

replace

http://search.twitter.com/trends.json

with

http://api.twitter.com/1/trends.json

building with XCode 3.2.4

To build with XCode 3.2.4, targeting the simulator, I had to modify wax_class.m:

static NSMethodSignature *methodSignatureForSelector(id self, SEL _cmd, SEL selector) {

...

if TARGET_IPHONE_SIMULATOR

super.class = [self superclass];

else

super.super_class = [self superclass];

endif

to eliminate the #IF and only execute the line

super.super_class = [self superclass];

sqlite extension is broken

Found two issues trying to use sqlite extension:

  1. luaopen_wax_sqlite did not clear stack after creating global table. Should be
    BEGIN_STACK_MODIFY(L);
    luaL_newmetatable(L, WAX_SQLITE_METATABLE_NAME);
    luaL_register(L, NULL, metaFunctions);
    luaL_register(L, WAX_SQLITE_METATABLE_NAME, functions);
    END_STACK_MODIFY(L, 0);
  2. wax_sqlite_operation.m referes to wax_copyObject in operationComplete.
    wax_copyObject/wax_copyTable was removed from wax_helpers.h/.m in Feb 2010 (can be found through history though)

After fixing issues above all seems to work fine :)
One suggestion: give an option to return error codes to lua from executing sqlite commands. for now there is exceptions which is not cool at all

wax_server does not implement the NSNetServiceDelegate/NSStreamDelegate protocol

when compiling my wax project I always get the following errors (actually warnings, but I treat warnings as errors):

/depot/cocos2d-4u/cocos2d-4u/cocos2d-4u/projects/../libs/wax/lib/wax_server.m:144:0 /depot/cocos2d-4u/cocos2d-4u/cocos2d-4u/projects/../libs/wax/lib/wax_server.m:144: warning: class 'wax_server' does not implement the 'NSNetServiceDelegate' protocol

/depot/cocos2d-4u/cocos2d-4u/cocos2d-4u/projects/../libs/wax/lib/wax_server.m:165:0 /depot/cocos2d-4u/cocos2d-4u/cocos2d-4u/projects/../libs/wax/lib/wax_server.m:165: warning: class 'wax_server' does not implement the 'NSStreamDelegate' protocol

/depot/cocos2d-4u/cocos2d-4u/cocos2d-4u/projects/../libs/wax/lib/wax_server.m:170:0 /depot/cocos2d-4u/cocos2d-4u/cocos2d-4u/projects/../libs/wax/lib/wax_server.m:170: warning: class 'wax_server' does not implement the 'NSStreamDelegate' protocol

This is likely because of this code in wax_server.h (I'm compiling for min. iOS 3.1):

#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_3_2

@interface wax_server : NSObject <NSStreamDelegate, NSNetServiceDelegate> {

#else

@interface wax_server : NSObject {

#endif

I had to enclose the offending code in wax_server.m by the same

#if __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_3_2

statement.

Btw, there's a better to understand version of the macro available, which does the same thing:

#ifdef _USE_OS_4_OR_LATER
// code to compile for 4.0 or later
#else
// code to compile for pre-4.0
#endif

http://stackoverflow.com/questions/820142/how-to-target-a-specific-iphone-version

rake framework fail

when i rake package like this:
WAX_ROOT/tools/framework run rake package. wax.framework should now be in WAX_ROOT/framework/wax.framework

fail occur:

rake
(in /Users/kael/Downloads/probablycorey-wax-95c2a41/tools/Framework)
Scripts/build
Build settings from command line:
SDKROOT = iphoneos5.0

=== BUILD NATIVE TARGET Wax OF PROJECT Framework WITH CONFIGURATION Release ===
Check dependencies

PhaseScriptExecution "Compile stdlib scripts" build/Framework.build/Release-iphoneos/Wax.build/Script-0415600712D3DA2F00FA4BA9.sh
cd /Users/kael/Downloads/probablycorey-wax-95c2a41/tools/Framework
/bin/sh -c /Users/kael/Downloads/probablycorey-wax-95c2a41/tools/Framework/build/Framework.build/Release-iphoneos/Wax.build/Script-0415600712D3DA2F00FA4BA9.sh
lua: ...x-95c2a41/tools/Framework/wax/lib/build-scripts/luac.lua:40: invalid escape sequence near '.'
hexdump: wax.dat: No such file or directory
hexdump: wax.dat: Bad file descriptor
rm: wax.dat: No such file or directory

** BUILD FAILED **

The following build commands failed:
PhaseScriptExecution "Compile stdlib scripts" build/Framework.build/Release-iphoneos/Wax.build/Script-0415600712D3DA2F00FA4BA9.sh
(1 failure)
Build settings from command line:
SDKROOT = iphonesimulator5.0

=== BUILD NATIVE TARGET Wax OF PROJECT Framework WITH CONFIGURATION Release ===
Check dependencies

PhaseScriptExecution "Compile stdlib scripts" build/Framework.build/Release-iphonesimulator/Wax.build/Script-0415600712D3DA2F00FA4BA9.sh
cd /Users/kael/Downloads/probablycorey-wax-95c2a41/tools/Framework
/bin/sh -c /Users/kael/Downloads/probablycorey-wax-95c2a41/tools/Framework/build/Framework.build/Release-iphonesimulator/Wax.build/Script-0415600712D3DA2F00FA4BA9.sh
lua: ...x-95c2a41/tools/Framework/wax/lib/build-scripts/luac.lua:40: invalid escape sequence near '.'
hexdump: wax.dat: No such file or directory
hexdump: wax.dat: Bad file descriptor
rm: wax.dat: No such file or directory

** BUILD FAILED **

The following build commands failed:
PhaseScriptExecution "Compile stdlib scripts" build/Framework.build/Release-iphonesimulator/Wax.build/Script-0415600712D3DA2F00FA4BA9.sh
(1 failure)
rake aborted!
Command failed with status (65): [Scripts/build...]
/Users/kael/Downloads/probablycorey-wax-95c2a41/tools/Framework/Rakefile:5
(See full trace by running task with --trace)

can anybody help ?

I can't initialize NSDictionary or NSMutableDictionary in lua

I'm writing a method in lua, which should return a dictionary. Firstly, I try to use NSDictionray:dictionaryWithObjectsAndKeys(), but it didn't work. Later, I try NSMutableDictionary:init() or NSDictionary:init():mutableCopy(), but it crashed here:

    if (returnedInstanceUserdata) { // Could return nil
        [returnedInstanceUserdata->instance release]; // Wax automatically retains a copy of the object, so the alloc needs to be released
    }

Is there any way to create and return a dictionary in lua?

write Masonry in lua

When I try to write a UIButton and layout with Masonry it does not work! Who can look up in my code, it happen to crash while running!

Here:

add a UIImageView to cell.contentView

--local weakSelf = self
button:masUNDERxLINEmakeConstraints(
toblock(

           function(make)
              make:left():masUNDERxLINEequalTo(self:contentView())
              make:top():masUNDERxLINEequalTo(self:contentView())
              make:right():masUNDERxLINEequalTo(self:contentView())
              make:height():masUNDERxLINEequalTo(50)

             end,{"void","id"}
          )
     )

Possible small bug in wax_xml.m?

Hi Corey,

Shouldn't wax_xml.m, l.47 read
prefixElementNameSize = strlen((const char *)ns->prefix) + 1; // 1 is added because of the namespace colon :

?

wax 3rd-party framework & Catalog supporting issue in hybrid project

Since I'm using Xcode4, I don't know whether this is an xcode4 specific issue.

I'm using wax in a wax/objc hybrid project. n this project, I used an HTTP-client framework named LRResty(https://github.com/lukeredpath/LRResty). I dragged LRResty.framework from finder to my project, and did NOT select the 'copy files .... ' option. I can use this framework in objc code without problem, but I found I cannot use it in lua scripts.

I use this line of code to enable wax i(in - UIApplication didFinishLaunchingWithOptions:):

wax_start("init.lua", luaopen_wax_http, luaopen_wax_json, luaopen_wax_filesystem, nil);

and in init.lua, I wrote this line:

local resposne = LRResty:client():get("http://www.google.com/")

when I ran the project in iphone 4.3.2 simulator, I saw these in console output:

WARNING: No object named 'LRResty' found.
Error opening wax scripts: init.lua:5: attempt to index global 'LRResty' (a nil value)

I tried to add an dummy function in objc code to force load the framework:
void dummy { [[LRResty client] get:@""]; }
then another error cameout:

Error opening wax scripts: init.lua:5: attempt to call method 'get' (a nil value)

So, seem the framework has been found by wax, but wax cannot find the LRRestyClient::get: method.
I have to explain the the get: method is defined a catalog for class LRRestyClient, and I found I can successfully call
methods defined directly in non-catalog part of class LRRestyClient in lua script.

questions:

  1. Is there any way I can use 3rd-party framework in lua without write dummy codes in objc?
  2. Is the issue above a bug of wax specific to cataloges?
  3. If not, how can I use catalog in lua?

thanks.

no dealloc in iphone SDK 5.1

I have verified with allocation profille in xcode 4.2.3 and found that object created through wax lua did not get cleared even after wax gc cleared those object. How to fix this issue

Regards
Sethu

weirdness calling superclass method

According to the docs, I thought the way to call a superclass method
was "self.super:methodname(self)", no? It doesn't quite work:

With this code:

waxClass{"ParentClass", NSObject}

function init(self, options)
self = self.super:init()
self.k = options.k
return self
end

function doit(self)
print("ParentClass:doit")
print(self)
print(self.k)
end

waxClass{"ChildClass", ParentClass}

function init(self, options)
self = self.super:init(options)
self.v = options.v
return self
end

function doit(self)
print("ChildClass:doit")
print(self)
print(self.k)
print(self.v)
self.super:doit(self)
end

local v = ChildClass:init({ k = "blah", v = "yada"})
v:doit()

I get (notice that the self output changes in the child class, and
it's self.k value is now nil):

ChildClass:doit
(0xcb14674 => 0xcb14a90) <ChildClass: 0xcb14a90>
blah
yada
ParentClass:doit
(0xcb14504 => 0xcb14a90) <ChildClass: 0xcb14a90>
nil

Note that a successful workaround is:
self.super.doit(self)

I dunno if that's acceptable going forward or not...

Can't call overloaded objc method

A class Manager has two overloaded methods:

-(void) start;
-(void) start:(float)dt;

from Lua if I call

manager.start()

I'll get:

Not Enough arguments given! Method named 'start:' requires 2 argument(s), you gave 1. (Make sure you used ':' to call the method)

I tracked it down to wax_helpers:549

wax_selectorForInstance(wax_instance_userdata *instanceUserdata, const char *methodName, BOOL forceInstanceCheck)

It looks for first possible selector which is "start:" and then returns that as the method to use. It doesn't take into account how many arguments I passed in Lua.

Using a waxClass as superclass leads to infinite recursion

Basically it's an infinite recursion in wax_class.m::methodSignatureForSelector

I have something like so:

-- GenericTableViewController.lua
waxClass{"GenericTableViewController", UITableViewController, protocols = { ... } }

function init(self)
self.super:initWithStyle(UITableViewStylePlain)

...
end

-- NewAlbumsViewController.lua
waxClass{"NewAlbumsViewController", GenericViewController, protocols = { ... } }

function init(self)
self.super:init() -- <-- infinite recursion here
...
end

Basically it keeps calling methodSignatureForSelector infinitely.

The problem is this line:

signature = objc_msgSendSuper(&super, _cmd, selector);

In turn generates a call to methodSignatureForSelector(...), hence the infinite recursion.

Wax not displaying lua errors on Swift

wax_runLuaFile does not print any error found on lua script. I' have made a change in the source to look like this:

int wax_runLuaFile(const char *script){
[wax_globalLock() lock];
int i = luaL_dofile(wax_currentLuaState(), script);
if( i != 0 )
fprintf(stderr,"Error opening wax scripts: %s\n", lua_tostring(wax_currentLuaState(),-1));
[wax_globalLock() unlock];
return i;
}

and now I can see the errors.

Link error when adding wax.framework to cocos2d template project

Hi,

I followed the "installation framework" procedure, which works fine for ordinary iPhone project templates; but when using the cocos2d template I get link errors.
Seems like there's something in the "wax_xml" source.
Here's the output:

Ld build/Debug-iphonesimulator/CocosTest.app/CocosTest normal i386
cd /Users/Marc/Documents/CocosTest
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk -L/Users/Marc/Documents/CocosTest/build/Debug-iphonesimulator -F/Users/Marc/Documents/CocosTest/build/Debug-iphonesimulator -F/Users/Marc/Documents/CocosTest/../../Downloads -filelist /Users/Marc/Documents/CocosTest/build/CocosTest.build/Debug-iphonesimulator/CocosTest.build/Objects-normal/i386/CocosTest.LinkFileList -mmacosx-version-min=10.6 -all_load -ObjC -Xlinker -objc_abi_version -Xlinker 2 -framework CoreGraphics -framework Foundation -framework OpenGLES -framework QuartzCore -framework UIKit -framework AudioToolbox -framework OpenAL -lz -framework AVFoundation "-lcocos2d libraries" -framework CoreData -framework wax -o /Users/Marc/Documents/CocosTest/build/Debug-iphonesimulator/CocosTest.app/CocosTest

Undefined symbols:
"_xmlDocSetRootElement", referenced from:
_createXML in wax(wax_xml.o)
"_xmlDocGetRootElement", referenced from:
_parse in wax(wax_xml.o)
"_xmlDocDumpMemoryEnc", referenced from:
_generate in wax(wax_xml.o)
"_xmlAddChild", referenced from:
_createXML in wax(wax_xml.o)
_createXML in wax(wax_xml.o)
_createXML in wax(wax_xml.o)
"_xmlReadMemory", referenced from:
_parse in wax(wax_xml.o)
"_xmlNewNode", referenced from:
_createXML in wax(wax_xml.o)
"_xmlNewProp", referenced from:
_createXML in wax(wax_xml.o)
"_xmlIsBlankNode", referenced from:
_createTable in wax(wax_xml.o)
"_xmlNewText", referenced from:
_createXML in wax(wax_xml.o)
_createXML in wax(wax_xml.o)
"_xmlNewDoc", referenced from:
_generate in wax(wax_xml.o)
"_xmlFreeDoc", referenced from:
_generate in wax(wax_xml.o)
_parse in wax(wax_xml.o)
"_xmlFree", referenced from:
_xmlFree$non_lazy_ptr in wax(wax_xml.o)
(maybe you meant: _xmlFree$non_lazy_ptr)
"_xmlNodeListGetString", referenced from:
_createTable in wax(wax_xml.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status

selector question

why noti is nil
pSpriteB is my cocos2d sprite , collision occur, transfer pSpriteB

code in c++

[[NSNotificationCenter defaultCenter] postNotificationName:@"MS_TRIGGER" object:pSpriteB];

code in lua

waxClass{"luaSensor",CSensor}

function init(self)
self.super:init()
return self
end

function trigger(self,noti)
noti:Output2()

end

noti is nil ? help me:)

CAAnimation delegate crash

I'm creating an issue to keep track of an issue that I reported on the mailing list.

http://groups.google.com/group/iphonewax/browse_thread/thread/58d98c01e7f669c

Here's the sample program I created that demonstrates the issue:

waxClass{"AppDelegate", protocols = {"UIApplicationDelegate"}}

function applicationDidFinishLaunching(self, application)
local frame = UIScreen:mainScreen():bounds()
self.window = UIWindow:initWithFrame(frame)
self.window:setBackgroundColor(UIColor:orangeColor())

local label = UILabel:initWithFrame(CGRect(0, 100, 320, 40))
label:setFont(UIFont:boldSystemFontOfSize(30))
label:setColor(UIColor:orangeColor())
label:setText("Hello Lua!")
label:setTextAlignment(UITextAlignmentCenter)

local layer = label:layer()
animation = CABasicAnimation:animationWithKeyPath("opacity")
animation:setDuration(0.5)
animation:setRepeatCount(6)
animation:setAutoreverses(true)
animation:setFromValue(NSNumber:numberWithFloat(0))
animation:setToValue(NSNumber:numberWithFloat(1))
animation:setDelegate(self)
layer:addAnimation_forKey(animation, "blink")

self.window:addSubview(label)
self.window:makeKeyAndVisible()
end

function animationDidStop_finished(self, theAnimation, flag)
print("animation stopped")
end

Add support for Chameleon

I would love to see a version of Wax that can work with Chameleon (https://github.com/BigZaphod/Chameleon), a reimplementation of UIKit on top of OSX. This would allow one to use Wax to write apps that could run either on OSX or iOS.

The problem is that Wax needs some APIs (for example MapKit) and makes some assumptions about what is included by other includes, that it doesn't not compile directly.

Wax is such a lovely framework for writing iOS apps, I would love to be able to use it share code with OSX projects.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.