[Solved]Embedding C++ with scripts
Hi, just started reading on embedding scripting languages within C/C++.
There is something I am not getting.
I have read that you can call a scripted function in C++ as well as calling a C++ function in the scripting language, but what about the variables?
How do I access a variable in C++ in my script? Is it possible?
Also, how does the return work?
Say I want my script to return the result in a class called list, would it be able to do that?
Thanks in advance
Edit:
Okay, I get it, In lua, I can use the stack and etc.
I will revisit the stack section in the tutorial
Thank you
[Edited by - polarboy on June 17, 2009 8:45:22 PM]
Thanks for the quick reply, wasn't expecting such a quick one,haha
I have just read something called variable linking
but they are only used for certain types (ie int, char)
So I'm guessing it's best to avoid this? So I would probably just set up everything in my scripts and just call c++ functions (ie. render) while providing them with all the necessary parameters?
I have just read something called variable linking
but they are only used for certain types (ie int, char)
So I'm guessing it's best to avoid this? So I would probably just set up everything in my scripts and just call c++ functions (ie. render) while providing them with all the necessary parameters?
There are dozens and dozens of scripting languages out there, until you tell us the one your considering or looking at, we have no clue. Each one basically does it their own way.
Ah, okay, I don't know which one I'm gonna use yet, I'm just reading about them atm.
I'm looking at some tutorials for Lua, Python, GameMonkey and possibly PHP right now
I guess I'm really asking if this was possible to do rather than how to do it
I'm looking at some tutorials for Lua, Python, GameMonkey and possibly PHP right now
I guess I'm really asking if this was possible to do rather than how to do it
Quote:Original post by polarboyI would suggest you go with a scripting language which has been widely used in games - both Lua and GameMonkey are decent choices.
I'm looking at some tutorials for Lua, Python, GameMonkey and possibly PHP right now
PHP on the other hand, isn't widely used as a scripting language for games - it would work, but it is more oriented to web development, and there aren't as many resources on embedding. Python is also a bit large and unwieldy for game scripting use, and can be a bit of a pain to embed (even with tools such as boost::python).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement