diff options
| author | Anton Yabchinskiy | 2015-02-17 15:57:24 +0300 |
|---|---|---|
| committer | Anton Yabchinskiy | 2015-02-17 15:57:24 +0300 |
| commit | e024ff89b224f803fe335efa95d3e99bffc3423f (patch) | |
| tree | 84ca5323c97ef24cfcae202447ac6967783e9248 /core/variant_op.cpp | |
| parent | 6f93e6812edaf6c8c79c28dadbe5f1c4a8ced93e (diff) | |
| parent | 2bea642583efeb68886e71950384f297f2d7ee12 (diff) | |
| download | godot-e024ff89b224f803fe335efa95d3e99bffc3423f.tar.gz godot-e024ff89b224f803fe335efa95d3e99bffc3423f.tar.zst godot-e024ff89b224f803fe335efa95d3e99bffc3423f.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 fbb5e2631..21bbc8c7e 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; |
