Added ^ power operator,

Added abs, random_int, random_real, random_shuffle, random_select script functions.
Made == comparison of doubles use a small epsilon, so things like 3/2 == 1.5 are actually true.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1013 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-07-09 15:51:07 +00:00
parent 69fed99633
commit 7cb2292d36
10 changed files with 167 additions and 26 deletions
+2 -2
View File
@@ -344,7 +344,7 @@ class ScriptBreakRule : public ScriptValue {
virtual String typeName() const { return _("break_rule"); }
virtual ScriptValueP eval(Context& ctx) const {
SCRIPT_PARAM_C(String, input);
intrusive_ptr<ScriptCustomCollection> ret(new ScriptCustomCollection);
ScriptCustomCollectionP ret(new ScriptCustomCollection);
while (regex.Matches(input)) {
// match, append to result
size_t start, len;
@@ -393,7 +393,7 @@ SCRIPT_FUNCTION_WITH_SIMPLIFY(break_text) {
SCRIPT_PARAM_C(String, input);
SCRIPT_PARAM_C(ScriptRegexP, match);
SCRIPT_OPTIONAL_PARAM_C_(ScriptRegexP, in_context);
intrusive_ptr<ScriptCustomCollection> ret(new ScriptCustomCollection);
ScriptCustomCollectionP ret(new ScriptCustomCollection);
// find all matches
while (match->regex.Matches(input)) {
// match, append to result