Browse Source

Lua : Fixes for String

We need to add some lua-specific getter behavior for handling "length"
fields, etc.
Justin Donaldson 10 years ago
parent
commit
76b80d1123
1 changed files with 2 additions and 2 deletions
  1. 2 2
      std/lua/_std/String.hx

+ 2 - 2
std/lua/_std/String.hx

@@ -37,7 +37,7 @@ class String {
 	@:keep
 	static function __index(s:Dynamic, k:Dynamic) : Dynamic {
 		if (k == "length") return untyped __lua__("#s");
-		else return null;
+		else return untyped String.prototype[k];
 	}
 
 
@@ -80,7 +80,7 @@ class String {
 
 	public function substr( pos : Int, ?len : Int ) : String {
 		if (len == null || len > pos + this.length) len = this.length;
-		return lua.StringTools.sub(this, pos + 1, pos+len + 1);
+		return lua.StringTools.sub(this, pos + 1, pos+len);
 	}
 
 	public static function fromCharCode( code : Int ) : String {