开发者

Exposing Ogre functions using tolua++

I want to know h开发者_高级运维ow do I expose Ogre library functions, for example: pitch, yaw to rotate a camera..I want to control the camera for my application using a lua script. I m doing the binding using tolua++. I created a cleaned header for OgreCamera.h but apparently the function is not getting exposed because when i use lua_call in my C++ code, the program terminates with an exit code 1. In my lua script I write the statement pMyCam:yaw(angle) where pMyCam is of type Ogre::Camera* and is passed to lua. The problematic statement is the call to yaw.

Are there any other


What you seek is luabind, at least that's what I'm using with Ogre basically just right now. It's pretty easy syntax-wise, you can expose nearly everything including overloaded methods, readonly attributes, enums and whatnot and it works perfectly fine for me.

I'm using it in a wrapper engine that includes Ogre, CEGUI (if you're using that as well) and some other stuff as well and so far I managed to expose nearly everything I need to Lua, inlcuding camera-, scene- and object management.

And yes, it's designed to work with c++.


Nowadays there are some of libraries that allow direct access of functions in C libraries.

Like these:

  • LuaJIT's FFI
  • Alien
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜