(l *lua.State, idx int)
| 107 | } |
| 108 | |
| 109 | func pullArrayRec(l *lua.State, idx int) (interface{}, error) { |
| 110 | table := make([]interface{}, lua.LengthEx(l, idx)) |
| 111 | |
| 112 | l.PushNil() |
| 113 | for l.Next(idx) { |
| 114 | k, ok := l.ToInteger(-2) |
| 115 | if !ok { |
| 116 | l.Pop(2) |
| 117 | return nil, fmt.Errorf("pull array: expected numeric index, got '%s'", l.TypeOf(-2)) |
| 118 | } |
| 119 | |
| 120 | v, err := toGoValue(l, -1) |
| 121 | if err != nil { |
| 122 | l.Pop(2) |
| 123 | return nil, err |
| 124 | } |
| 125 | |
| 126 | table[k-1] = v |
| 127 | l.Pop(1) |
| 128 | } |
| 129 | |
| 130 | return table, nil |
| 131 | } |
| 132 | |
| 133 | func toGoValue(l *lua.State, idx int) (interface{}, error) { |
| 134 | t := l.TypeOf(idx) |
no test coverage detected