cocos2d/cocos2d-x — pull request #1776 by dualface (2012-12-22 02:37:14+00:00)
Title: [luabinding] make CCAssert compatible Lua

This patch avoid CCAssert interrupt program execution, and push an error message to the Lua Stack.

How to use:

``` lua
function __G__TRACKBACK__(errorMessage)
print("----------------------------------------")
print("LUA ERROR: "..tostring(errorMessage).."\n")
print(debug.traceback("", 2))
print("----------------------------------------")
end

xpcall(function()
local scene = CCScene:create()
local sprite = CCSprite:create("hello.png")

scene:addChild(sprite)
scene:addChild(sprite) -- ERROR: repeat addChild()
end, __G__TRACKBACK__)
```

output:

```
----------------------------------------
LUA ERROR: ASSERT FAILED ON LUA EXECUTE: child already added. It can't be added again

stack traceback:
[C]: in function 'addChild'
...ce/Documents/Games/test/client_scripts/main_editor.lua:13: in function <...ce/Documents/Games/test/client_scripts/main_editor.lua:8>
[C]: in function 'xpcall'
...ce/Documents/Games/test/client_scripts/main_editor.lua:8: in main chunk
----------------------------------------

```