This looks great.
Thanks for another great library. At first, I thought "No, not another code parser" but I was wrong.
This is nothing new, other scripting engines have done it before but CAMP does it nicely and in a more generic way.
I am still somewhat confused on how you would use CAMP with a scripting language such as lua.
CAMP acts as a bridge between C++ and lua. Of course, you still have to write some glue code.
It can be used like this:
For example if your lua scripts call a function like "shootMonster()".
You bind a generic C++ function to that.
The generic function looks up all registered C++ functions in CAMP and finds whether there is a function named "shootMonster". If there is, it is called, if not, an error is returned.
Hm, well I know.. I think my problem is that I'm not used to deal with dynamic structure Wink, I'm not seeing where/what dynamic variety can I add to my code that I can't do statically with abstract classes
When you bind anything static to something dynamic like a string or number, you just did a bit of reflection. Just think about how a game editor is implemented:
When you select an object in an editor, the editor must call a method like "queryProperties" which returns a set of properties that object has so that it can populate the property panel.
The return value is something like a list of properties:
1) HP , set it with method setHP, at address ..., get it with method getHP at address ...
2) Mana = 20, set it with ... etc
The editor will store these properties name in a hash table and map it with its respective getter/setter... so that it knows what method to call
In the end, this is what CAMP does. Instead of doing it before hand, you do it "on-the-fly".
And how do you implement the "queryProperties()" method?
Mapping a list of getter/setter pointers to the
string name of the properites??? Isn't it reflection? Isnt it what CAMP does? :wink: [/quote]