I am trying to implement Lua into my game, but am having trouble. Say I have a weapon class, which is just a hollow shell, lacking real functions. I was thinking of creating an onFire function, which will simply call a pointer to a Lua function that was created for that weapon. Is this the way most people do it? Are there any other ways?


closed as not constructive by Nicol Bolas, Josh, sam hocevar, MichaelHouse, bummzack Feb 14 '13 at 16:30

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    \$\begingroup\$ This question is really too open-ended. You need to, at the very least, explain in some detail about what you want scripts to control and do in your game. \$\endgroup\$ – Nicol Bolas Feb 14 '13 at 5:27

You can indeed call Lua functions from C++ code, you'd just need to import a Lua header and compile against Lua libraries

This site offers great examples: Using Lua with C++


Not the answer you're looking for? Browse other questions tagged or ask your own question.