Browse Source

Lua: Use 1-based indexing for raw lua tables in EReg

Justin Donaldson 10 years ago
parent
commit
c9431b31e0
1 changed files with 3 additions and 3 deletions
  1. 3 3
      std/lua/_std/EReg.hx

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

@@ -46,7 +46,7 @@ class EReg {
 	public function match( s : String ) : Bool {
 		m = Table.pack(r.exec(s));
 		this.s = s;
-		return m[0] != null;
+		return m[1] != null;
 	}
 
 	public function matched( n : Int ) : String {
@@ -74,8 +74,8 @@ class EReg {
 	public function matchedPos() : { pos : Int, len : Int } {
 		if( m == null ) throw "No string matched";
 		return {
-			pos : m[0]-1,
-			len : m[1]- m[0]+ 1
+			pos : m[1]-1,
+			len : m[2]- m[1]+ 1
 		}
 	}