Przeglądaj źródła

Lua: Only use the Ereg.split workaround if global is not specified

Justin Donaldson 9 lat temu
rodzic
commit
50c116c3ae
1 zmienionych plików z 7 dodań i 3 usunięć
  1. 7 3
      std/lua/_std/EReg.hx

+ 7 - 3
std/lua/_std/EReg.hx

@@ -104,9 +104,13 @@ class EReg {
 	}
 	}
 
 
 	public function split( s : String ) : Array<String> {
 	public function split( s : String ) : Array<String> {
-		// we can't use directly Rex.split because it's ignoring the 'g' flag
-		var d = "#__delim__#";
-		return Boot.luaIteratorToArray(Rex.split(replace(s,d), d));
+		if (global){
+			return Boot.luaIteratorToArray(Rex.split(s, r));
+		} else {
+			// we can't use directly Rex.split because it's ignoring the 'g' flag
+			var d = "#__delim__#";
+			return Boot.luaIteratorToArray(Rex.split(replace(s,d), d));
+		}
 	}
 	}
 
 
 	public function replace( s : String, by : String ) : String {
 	public function replace( s : String, by : String ) : String {