The result would be 1, of course. Having no support for this kind of thing in C++ and knowing how to code without it, I honestly don’t know where it would ever be that much easier than an array that it would be worthwhile. The above, for example, could just as easily be:
varArray = {
"cat": var_cat,
"dog": var_dog,
"bird": var_bird
};
player.chat = varArray["cat"];
The direct array access with the 0 is the most efficient, but less competent scripters will try to use strings everywhere. So ultimately it’s a convenience feature. Also, these are terrible examples, but they’re all valid code for this scripting engine.
Still working on it. Just not much to note. I’ll probably slow down a bit, because I’ve been skipping out on exercising to work on it, which is a problem. As for the project, I had to go back to the compiler briefly to redo variable handling yet again. (Those changes are already done, nothing significant.) I wasn’t happy with the options for integrating built-in variables with the way it was designed. The new plan seems great so far.
I’ll post as noteworthy changes are made, but it may not be daily. If I decide to stop again for whatever reason, I’ll post that as well.
Classes were intended, but not necessary, so I decided to delay adding them. You can basically simulate classes anyway. Any variable can have new subvariables added at any time. That combined with arrays being as flexible as they are should be more than adequate, I’d say.
Ok, I got the new variable shit mostly done. I should be able to finish tomorrow. It’ll definitely allow a good method of accessing built-in variables. (Things like “script”, “params” (for function call parameters), or any built-in function like math functions or client-related functions.)
Work has been really stressful the past week or so. I’ve been coming home and not wanting to think about anything, so there’s been no progress, unfortunately. I want to get back to it again soon.
Well surprise, bitch. I worked on it for a while today. I think the variable updates are complete, after running into some not-so-insignificant issues. Lots of updates had to be made throughout the code. Everything is now in place to start implementing the built-in functions/variables. I’m starting on that tonight, and don’t expect any issues with it.