张金坤 9 年之前
父节点
当前提交
1b379f0386
共有 2 个文件被更改,包括 7 次插入2 次删除
  1. 1 1
      common/src/github.com/yuin/gopher-lua/auxlib.go
  2. 6 1
      common/src/github.com/yuin/gopher-lua/tablelib.go

+ 1 - 1
common/src/github.com/yuin/gopher-lua/auxlib.go

@@ -239,7 +239,7 @@ func (ls *LState) ArgError(n int, message string) {
 }
 
 func (ls *LState) TypeError(n int, typ LValueType) {
-	ls.RaiseError("bad argument #%v to %v (%v expected, got %v)", n, ls.rawFrameFuncName(ls.currentFrame), typ.String(), ls.Get(n).Type().String())
+	//ls.RaiseError("bad argument #%v to %v (%v expected, got %v)", n, ls.rawFrameFuncName(ls.currentFrame), typ.String(), ls.Get(n).Type().String())
 }
 
 /* }}} */

+ 6 - 1
common/src/github.com/yuin/gopher-lua/tablelib.go

@@ -30,7 +30,12 @@ func tableSort(L *LState) int {
 }
 
 func tableGetN(L *LState) int {
-	L.Push(LNumber(L.CheckTable(1).Len()))
+	if v := L.CheckTable(1); v != nil {
+		L.Push(LNumber(v.Len()))
+	} else {
+		L.Push(LNumber(0))
+	}
+	//L.Push(LNumber(L.CheckTable(1).Len()))
 	return 1
 }