Browse Source

support for Dynamic strings concatenation

It also works for many other concatenation situations.

Dynamic example:
```
var x:Dynamic = null;
var y:Dynamic = "hello";
//Dynamic var + Dynamic var, where one is null, the other is a string:
var c = x + y;
```
This will *not* be compiled as `x .. y` and also will throw `arifmetic
on nil value` error.
PeyTy 10 years ago
parent
commit
5e91f503af
1 changed files with 1 additions and 0 deletions
  1. 1 0
      std/lua/_std/String.hx

+ 1 - 0
std/lua/_std/String.hx

@@ -32,6 +32,7 @@ class String {
 
 	static function __init__() : Void untyped{
 		__lua__("getmetatable('').__index = String.__index");
+		__lua__("getmetatable('').__add = function(a,b) return Std.string(a)..Std.string(b) end");
 	}
 
 	@:keep