im not exactly sure how to word this,so im sorry if this makes someones head explode.
im writing a script language parser for a game im working on. now i know this sorta thing is possible for writing compilers and such, but so far i havent found anything i can use. im reading the script from a file, which now works by the way. (thanx Athar) and then use the value of a string variable to execute a function with the same name.
If the functions have different parameters, you can just use if-else-cascades.
If you're talking about functions defined in the script defined by the user, things get a bit trickier.
You'll have to remember for each function how many parameters it takes and of which type they are (if your script language needs explicit type specification).
By the way, why not use an existing script language like Lua? It interfaces nicely with C++.
well something like that would be nice, but im going to be using this mostly for Wii Software Development, and i dont think ive seen a reliable lua engine for it yet. as well a i'd like to have something that i can use for testing on windows, and Wii, without having to make any real changes to the code. i will take a more in-depth look into the lua stuff though. might be worth will down the road. thanx for the info though.
actually i looked at the code for the Wii version of Lua, and right now it doesnt seem to be what i need for this project at the moment. but just curious, is there a similar to map to be used with variables instead of actual functions? or can it be used for variables as well.
thanks again Athar. you've been a huge help. i never had thought of using the mapping stuff before, as when i was programming for DOS, it either wasnt part of the compiler i used or i was never show it. but either way it works wonders. my script interpreter is coming along quite nicely. thanks again. im sure as i go i'll ask for more help.