Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Lua outputs all arrays. The length of this array is not fixed, such as a[ 1] ... a ... A [3]. I want to store the contents of the whole array in a variable.
Lua outputs all arrays. The length of this array is not fixed, such as a[ 1] ... a ... A [3]. I want to store the contents of the whole array in a variable.
localt={ 1,3,5,7,9, 1 1, 13 } local fun = { } fun . max = function(t)return math . max(unpack(t))end fun . count = fun(t)return # tend print(fun . count(t)) fun . sum = fun(t)local sum = 0 for I,vin pairs(t)dosum = sum+vendreturnsumendfun . avg = fun。 Avg (t)) print (fun. Max (t)) print (fun. Min (t)) print (fun. Varp (t)) printing (fun. Stdevp (t)) It's really enough for you to give 5 points, which also shows that you don't attach importance to knowledge.