diff options
| author | Bil Bas (Spooner) | 2015-01-10 20:44:20 +0000 |
|---|---|---|
| committer | Bil Bas (Spooner) | 2015-01-10 20:44:20 +0000 |
| commit | 7a41f8c604143eec16c232cffda122b095c5108f (patch) | |
| tree | d75667bb5392db5dea502b0bfbb8e36f914a81e6 /core/variant_op.cpp | |
| parent | d6d85a23c9061149c7996a3b434e6f9b25a81e49 (diff) | |
| download | godot-7a41f8c604143eec16c232cffda122b095c5108f.tar.gz godot-7a41f8c604143eec16c232cffda122b095c5108f.tar.zst godot-7a41f8c604143eec16c232cffda122b095c5108f.zip | |
Diffstat (limited to 'core/variant_op.cpp')
| -rw-r--r-- | core/variant_op.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/variant_op.cpp b/core/variant_op.cpp index ec43b1275..533a9d695 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -736,6 +736,20 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant& } #endif _RETURN( p_a._data._int % p_b._data._int ); + + } else if (p_a.type==STRING) { + const String *str=reinterpret_cast<const String*>(p_a._data._mem); + + if (p_b.type==ARRAY) { + // e.g. "frog %s %d" % ["fish", 12] + const Array *arr=reinterpret_cast<const Array*>(p_b._data._mem); + _RETURN(str->sprintf(*arr)); + } else { + // e.g. "frog %d" % 12 + Array arr; + arr.push_back(p_b); + _RETURN(str->sprintf(arr)); + } } r_valid=false; |
