File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ function main()
9
9
[" str" ] = json .array (" hello" ),
10
10
[" int" ] = json .array (12 ),
11
11
[" bool" ] = json .array (true ),
12
- [" float" ] = json .array (12.34 )
12
+ [" float" ] = json .array (12.34 ),
13
+ [" empties" ] = json .array (json .array ())
13
14
}
14
15
end
Original file line number Diff line number Diff line change @@ -84,6 +84,12 @@ func apiArray(state *lua.LState) int {
84
84
}
85
85
}
86
86
87
+ // Wrap user data in an array
88
+ if custom , ok := state .CheckAny (1 ).(* lua.LUserData ); ok {
89
+ state .Push (& lua.LUserData {Value : []any {custom .Value }})
90
+ return 1
91
+ }
92
+
87
93
// Otherwise, return an array
88
94
fallthrough
89
95
default :
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ func TestEmptyArray(t *testing.T) {
307
307
"str": ["hello"],
308
308
"int": [12],
309
309
"bool": [true],
310
- "float": [12.34]
310
+ "float": [12.34],
311
+ "empties": [[]]
311
312
}` , string (b ))
312
-
313
313
}
You can’t perform that action at this time.
0 commit comments