TableScript Alpha 3
This is the third release of TableScript. It's actually working. :) Do a 'make' to build the interpreter (ts), then run a table:
ts tablefile.ts
Maps are still not supported, but pretty much everything else is. Sure it's leaking memory all over the place, but you won't notice it and I'll have it cleaned up soon enough.
Have a look in the tables directory for some examples of what you can do.
*** Join the TableScript Yahoo Group ***
*** visit http://groups.yahoo.com/group/tablescript ***
1. Table entries re-vamped. This is what is allowed:
table demo {
1: // empty result
2: ("This is an expression.")
3: ("This is a pre-block expression.") {print("This is the block.");}
4: {print("This is the block.");} ("This is a post-block expression.")
5: {print("This is the block.");}
}
The previous version allowed an arbitrary list of expressions or blocks, but that made the table result kind of complicated.
2. Built-in functions:
print(string); => prints the string
range(integer); => returns a list from 0 to integer - 1
len(list); => returns the number of elements in list
append(list,value); => appends value to the end of list
system(string); => launches the system command string
int(value); => cast to integer (not implemented?)
float(value); => cast to float (not implemented?)
str(value); => cast to string
3. ARGV is a global list of command line arguments.
4. ROLL is the actual roll value available in table scope.
1. Get maps working.
2. Make the memory management actually work. :)
3. Add an optional block of statements that run first when you roll on a table.
table example {
{ print("This runs before the roll is made."); }
1: { print("This is roll 1."); }
2-20: { print("This is roll 2-20."); }
}
4. Implement the "in" operator, as in:
i = 6;
if(i in [1,2,3,4,5,6]) {
print("This prints.");
} else {
print("This doesn't.");
}
5. Sort out how we're going to do user modules.
6. String formatting a la:
"this work's like %sin printf" % ["frick"]
7. Somehow work it out so that we can mark a table as unique, making it impossible to roll the same entry twice.
8. Make the dice descriptor a little more nifty. For example:
3d6 => as expected
4d6l(1) => 4d6 drop 1 low die
5d6l(2) => 5d6 drop 2 low dice
... There were a few more but I've forgotten them...
Enjoy!
J