Home » Community » Newbie corner » Please recommend a scripting language
Please recommend a scripting language [message #32814] |
Sun, 12 June 2011 21:36 |
Lance
Messages: 527 Registered: March 2007
|
Contributor |
|
|
My situation is something like this:
There is a product P (eg. a newspaper); it has variations for each weekday, P1, P2, ..., P7. Now we believe it would be more convenient to let the user just enter P and have my program to translate it to Pi according to today's weekday.
This is trivial if I am satisfied with hardcoding it.
But that might be similar product Q, or even some other ways of translating from one code to another. So using a scripting language to define translations is more suitable in this situation.
I would define a function in U++
int TodaysDayOfWeek()
{
// return 1 to 7 according to today's date
}
// register this function with the script language engine
and then I can associate a string with P,
Then in my program, I can evaluate this expression using the script language engine to arrive at the intended product code.
Yes, many script language will be able to get system date and get the week day of the date natively, so please think it as a case when the script engine has to rely on an externally defined function.
Esc, v8, python, which comes closer to my requirements? Please offer your insight, thanks!
|
|
|
Goto Forum:
Current Time: Sat May 18 11:03:55 CEST 2024
Total time taken to generate the page: 0.03544 seconds
|