Skip to content

Add ability to get class name form a tolua c++ class. #179

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 13, 2016
Merged

Conversation

xpol
Copy link
Contributor

@xpol xpol commented Oct 10, 2015

Add class_table[".name"] = classname.
This enables ability to get class name form a tolua c++ class.

eg print(cc.Node['.name']) -- will prints "cc.Node".

This should solve cocos2d/cocos2d-x#14101.

This enables ability to get class name form a tolua c++ class.

eg `print(cc.Node['.name'])` -- will prints "cc.Node".
@xpol xpol changed the title This enables ability to get class name form a tolua c++ class. Add ability to get class name form a tolua c++ class. Oct 10, 2015
@xpol
Copy link
Contributor Author

xpol commented Oct 10, 2015

Or shall we use 'name' instead of '.name' as key?
So that print(cc.Node['.name']) becomes print(cc.Node.name).

So that class instance will also have access to its classname.

eg.

print(cc.Node['.classname'])
print(node['.classname'])
@minggo
Copy link
Contributor

minggo commented Jul 13, 2016

I think use cc.Node['name'] is better

@minggo
Copy link
Contributor

minggo commented Jul 13, 2016

may be cc.Node['.classname'] is better since

  • calssname is more clear
  • use . to let users know it is a meta data

@minggo
Copy link
Contributor

minggo commented Jul 13, 2016

looks good to me, so merge it

@minggo minggo merged commit 6fbafe2 into cocos2d:v3 Jul 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants