travis-ci
43 of 43 new or added lines in 2 files covered. (100.0%)
8118 of 8972 relevant lines covered (90.48%)
1036932.14 hits per line
1 |
package lua
|
|
2 |
|
|
|
func LuaToGo(value LValue) interface{} { |
60✔ |
|
switch value.Type() {
|
60✔ |
|
case LTNil:
|
3✔ |
|
return nil |
3✔ |
|
case LTBool:
|
9✔ |
|
return value == LTrue
|
9✔ |
|
case LTNumber:
|
24✔ |
|
nm := value.(LNumber) |
24✔ |
|
if nm.IsInteger() {
|
45✔ |
|
return nm.Integer()
|
21✔ |
|
} |
21✔ |
|
return nm.Float()
|
3✔ |
|
case LTString:
|
15✔ |
|
return value.(LString).String()
|
15✔ |
|
case LTFunction:
|
× |
|
return nil |
× |
|
case LTTable:
|
9✔ |
|
return LuaTableToGo(value.(LTable))
|
9✔ |
21 |
} |
|
|
return "" |
× |
23 |
} |
|
24 |
|
|
|
func LuaTableToGo(t LTable) interface{} { |
9✔ |
|
r := make(map[interface{}]interface{}) |
9✔ |
|
|
9✔ |
|
t.ForEach(func(k, v LValue) {
|
27✔ |
|
kg := LuaToGo(k) |
18✔ |
|
vg := LuaToGo(v) |
18✔ |
|
|
18✔ |
|
r[kg] = vg |
18✔ |
|
}) |
18✔ |
34 |
|
|
|
return r
|
9✔ |
36 |
|
|
37 |
} |