These are chat archives for ChaiScript/ChaiScript
Hi came across ChaiScript while looking into LUA... I have no scripting background what so ever, so looking at LUA... Was kind of like a nightmare. Then I found ChaiScript and a sudden rush of relief came over me, seriously. I mean so far I've only made the HelloWorld example, and built a Wrapper class for ChaiScript... but that took me like 10 minutes (if that). Where as with LUA, I still didn't have a working example. Great job, love it! I do have 3 questions though....
1) I will be calling Scripts from within objects in my C++ code, is there any way that I can inform the script of the object that called it... For example, say I had a Monster object execute the Script. Then from within the script, I want to be able to call C++ functions that get properties for the Monster, so I need a way to access the right monster... If worse comes to worse, I could just pass in the ID of the monster and call a function on the collection of monsters instead (if we can pass in values).
2) Correct me if I'm wrong here, but calling eval_file loads in the script every time right? So if for example I run the script 9000 times (kill 9000 monsters, run a script each time) the script gets loaded and executed 9000 times. Is there anyway to load it in once, and just execute it 9000 times?
3) Out of curiosity, has ChaiScript been used on an MMORPG in the past (or anything on that scale). I'm asking because I'd like to know what their opinions were on the performance aspect of things. (We can't have threads tied up calling script functions for long periods of times)
eval_filedoes evaluate the entire script when it is called. The best thing to do would be to have
eval_filereturn a function that is reusable, then call that function for each kill in your example