Random number in AutoIt is not working - random

The intention of this string is to generate a random number in this format: l = letter n = num,
LLNNN
Instead, it gives me this:
NN
Or sometimes:
N
Code
Local $destination = "C:\Users\Ryan\Pictures\Aurora.jpg"
If Random() < 1 Then
$Lettera = Chr(Random(Asc("A"), Asc("Z")))
Endif
If Random() < 1 Then
$Letterb = Chr(Random(Asc("A"), Asc("Z")))
Endif
If Random() < 1 Then
$Numbera = Chr(Random(48, 57, 1))
Endif
If Random() < 1 Then
$Numberb = Chr(Random(48, 57, 1))
Endif
If Random() < 1 Then
$Numberc = Chr(Random(48, 57, 1))
Endif
SplashImageOn("Splash", $destination, 312, 146, 450, 300, 1)
Sleep(9000)
SplashOff()
If MsgBox(1, "code generator", "Create a new key?") = 1 Then
msgBox(0, "code generator", "Your registry is:" + $Lettera + $Letterb + $Numbera + $Numberb + $Numberc)
EndIf

You could assign everything as a string value and then append it all at the end.
Local $destination = "C:\Users\Ryan\Pictures\Aurora.jpg"
If Random() < 1 Then
$Lettera = Chr(Random(Asc("A"), Asc("Z")))
Endif
If Random() < 1 Then
$Letterb = Chr(Random(Asc("A"), Asc("Z")))
Endif
If Random() < 1 Then
$Numbera = Chr(Random("48", "57", "1"))
Endif
If Random() < 1 Then
$Numberb = Chr(Random("48", "57", "1"))
Endif
If Random() < 1 Then
$Numberc = Chr(Random("48", "57", "1"))
Endif
SplashImageOn("Splash", $destination, 312, 146, 450, 300, 1)
Sleep(9000)
SplashOff()
If MsgBox(1, "code generator", "Create a new key?") = 1 Then
msgBox(0, "code generator", "Your registry is:" & $Lettera & $Letterb & $Numbera & $Numberb & $Numberc)
EndIf

Related

PySpark Transform an algorithm to UDF and apply it on a DataFrame

I wrote an algorithm that does something and prints the output. The input for my algorithm is a list with some integers.
Here is the sample input as a list.
`mylist = [5,6,14,15,16,17,18,19,20,28,40,41,42,43,44,55]`
and here is my algorithm
```
tduration = 0
duration = 0
avg = 0
bottleneck = 0
y = 0
x = 0
while x<len(mylist)-4 and y<len(mylist)-1 :
if mylist[x+4] == mylist[x]+4:
y = x + 4
print("MY LIST X = ",mylist[x])
print("X = ", x)
print ("Y = ", y)
while True:
if y==len(mylist)-1 or mylist[y+1] > mylist[y]+10:
bottleneck = bottleneck + 1
duration = mylist[y] - mylist[x] + 1
tduration = tduration + duration
avg = tduration/bottleneck
x = y + 1
print("MY LIST Y = " , mylist[y])
print("Duration = " , duration)
break
else:
y = y + 1
else:
x = x + 1
print("BottleneckCount = ", bottleneck, "\nAverageDuration = ", avg)
```
Now I want to transform this "Algorithm" to a User Defined Function (UDF) in PySpark and then apply this UDF to a DataFrame with one column. There is one list in each row of this DataFrame. Sample DataFrame has 1 column and 2 rows. row1 is a list of [10,11,19,20,21,22,23,24,25,33,45] and row2 is a list of [55,56,57,58,59,60,80,81,82,83,84,85,92,115] so the UDF should be applied to each row of DataFrame separately and give the results for each row in another column.
Thank you in advance for your time and help. I will upvote your answers
Here's a way you can do:
import pyspark.sql.functions as F
from pyspark.sql.types import IntegerType, ArrayType
def calculate(mylist):
tduration = 0
duration = 0
avg = 0
bottleneck = 0
y = 0
x = 0
while x<len(mylist)-4 and y<len(mylist)-1 :
if mylist[x+4] == mylist[x]+4:
y = x + 4
print("MY LIST X = ",mylist[x])
print("X = ", x)
print ("Y = ", y)
while True:
if y==len(mylist)-1 or mylist[y+1] > mylist[y]+10:
bottleneck = bottleneck + 1
duration = mylist[y] - mylist[x] + 1
tduration = tduration + duration
avg = tduration/bottleneck
x = y + 1
print("MY LIST Y = " , mylist[y])
print("Duration = " , duration)
break
else:
y = y + 1
else:
x = x + 1
return bottleneck, avg
# sample data frame to use
df = spark.createDataFrame(
[
[[10,11,19,20,21,22,23,24,25,33,45]],
[[55,56,57,58,59,60,80,81,82,83,84,85,92,115]],
],
['col1',]
)
df.show()
+--------------------+
| col1|
+--------------------+
|[10, 11, 19, 20, ...|
|[55, 56, 57, 58, ...|
+--------------------+
# convert values to int --- edit
f_to_int = F.udf(lambda x: list(map(int, x)))
df = df.withColumn('col1', f_to_int('col1'))
# create udf
func = F.udf(lambda x: calculate(x), ArrayType(IntegerType()))
# apply udf
df = df.withColumn('vals', func('col1'))
# create new cols
df = df.select("col1", df.vals[0].alias('bottleneck'), df.vals[1].alias('avg'))
df.show()
+--------------------+----------+----+
| col1|bottleneck| avg|
+--------------------+----------+----+
|[10, 11, 19, 20, ...| 1|null|
|[55, 56, 57, 58, ...| 2|null|
+--------------------+----------+----+
YOLO answered this question and it is a complete answer. The only problem is that in the last column for "avg", we are getting NULL values.
I realized that I can solve this problem by using this "func" instead of that "func" in YOLO's answer.
import pyspark.sql.types as T
func = F.udf(lambda x: calculate(x), T.StructType(
[T.StructField("val1", T.IntegerType(), True),
T.StructField("val2", T.FloatType(), True)]))

Need to read width/height from graphics file with VBScript/ASP classic

I need to read a graphics file and get the width/height in VBScript (ASP). I found a package called gfxSpex that seems to be what a lot of people use but the GIFs get the width right but not the height. PNGs don't work at all as the routine is looking for the type in 0-3 and that's %PN in the .png files.
Function gfxSpex(flnm, width, height, depth, strImageType)
Dim strPNG
Dim strGIF
Dim strBMP
Dim strType
strType = ""
strImageType = "(unknown)"
gfxSpex = False
strPNG = Chr(137) & Chr(80) & Chr(78)
strGIf = "GIF"
strBMP = Chr(66) & Chr(77)
strType = GetBytes(flnm, 0, 3)
If strType = strGIf Then ' is GIF
strImageType = "GIF"
Width = lngConvert(GetBytes(flnm, 7, 2))
Height = lngConvert(GetBytes(flnm, 9, 2))
Depth = 2 ^ ((Asc(GetBytes(flnm, 11, 1)) And 7) + 1)
gfxSpex = True
ElseIf Left(strType, 2) = strBMP Then ' is BMP
strImageType = "BMP"
Width = lngConvert(GetBytes(flnm, 19, 2))
Height = lngConvert(GetBytes(flnm, 23, 2))
Depth = 2 ^ (Asc(GetBytes(flnm, 29, 1)))
gfxSpex = True
ElseIf strType = strPNG Then ' Is PNG
strImageType = "PNG"
Width = lngConvert2(GetBytes(flnm, 19, 2))
Height = lngConvert2(GetBytes(flnm, 23, 2))
Depth = getBytes(flnm, 25, 2)
Select Case Asc(right(Depth,1))
Case 0
Depth = 2 ^ (Asc(left(Depth, 1)))
gfxSpex = True
Case 2
Depth = 2 ^ (Asc(left(Depth, 1)) * 3)
gfxSpex = True
Case 3
Depth = 2 ^ (Asc(left(Depth, 1))) '8
gfxSpex = True
Case 4
Depth = 2 ^ (Asc(left(Depth, 1)) * 2)
gfxSpex = True
Case 6
Depth = 2 ^ (Asc(left(Depth, 1)) * 4)
gfxSpex = True
Case Else
Depth = -1
End Select
Else
strBuff = GetBytes(flnm, 0, -1) ' Get all bytes from file
lngSize = Len(strBuff)
flgFound = 0
strTarget = Chr(255) & Chr(216) & Chr(255)
flgFound = InStr(strBuff, strTarget)
If flgFound = 0 Then
Exit Function
End If
strImageType = "JPG"
lngPos = flgFound + 2
ExitLoop = False
Do While ExitLoop = False And lngPos < lngSize
Do While Asc(Mid(strBuff, lngPos, 1)) = 255 And lngPos < lngSize
lngPos = lngPos + 1
Loop
If Asc(Mid(strBuff, lngPos, 1)) < 192 Or Asc(Mid(strBuff, lngPos, 1)) > 195 Then
lngMarkerSize = lngConvert2(Mid(strBuff, lngPos + 1, 2))
lngPos = lngPos + lngMarkerSize + 1
Else
ExitLoop = True
End If
Loop
If ExitLoop = False Then
Width = -1
Height = -1
Depth = -1
Else
Height = lngConvert2(Mid(strBuff, lngPos + 4, 2))
Width = lngConvert2(Mid(strBuff, lngPos + 6, 2))
Depth = 2 ^ (Asc(Mid(strBuff, lngPos + 8, 1)) * 8)
gfxSpex = True
End If
End If
End Function
Function GetBytes(flnm, offset, bytes)
Dim objFSO
Dim objFTemp
Dim objTextStream
Dim lngSize
On Error Resume Next
Set objFSO = CreateObject("Scripting.FileSystemObject")
' First, we get the filesize
Set objFTemp = objFSO.GetFile(flnm)
lngSize = objFTemp.Size
Set objFTemp = Nothing
fsoForReading = 1
Set objTextStream = objFSO.OpenTextFile(flnm, fsoForReading)
If offset > 0 Then
strBuff = objTextStream.Read(offset - 1)
End If
If bytes = -1 Then ' Get All!
GetBytes = objTextStream.Read(lngSize) 'ReadAll
Else
GetBytes = objTextStream.Read(bytes)
End If
objTextStream.Close
Set objTextStream = Nothing
Set objFSO = Nothing
End Function
Function lngConvert(strTemp)
lngConvert = CLng(Asc(Left(strTemp, 1)) + ((Asc(Right(strTemp, 1)) * 256)))
End Function
Function lngConvert2(strTemp)
lngConvert2 = CLng(Asc(Right(strTemp, 1)) + ((Asc(Left(strTemp, 1)) * 256)))
End Function
Is anyone using this gfxSpex function and have they modified it? Is there a better way to get the width and height?
Yes, I'm not sure why the comment was deleted! Basically, it gave me a link to https://learn.microsoft.com/en-us/windows-hardware/drivers/image/wia-image-processing-filter. It's a lot more than I needed but good to know it's there. I just used:
set oIMG = CreateObject("WIA.ImageFile")
oIMG.loadFile(path)
iHeight = oIMG.Height
iWidth = oIMG.Width
set oIMG = nothing
It worked for gif, jpg, and png's. I didn't even need to register it.
If you have root access to your server I have a COM DLL that uses ExifTool to analyse file information and meta data for any file type and return the results as a JSON string.
Here's an example implementation:
Function file_information(ByVal full_path)
Dim ExifTool : Set ExifTool = Server.CreateObject("ClassicASP.ExifTool")
' If the file isn't found it returns an error string: "Error: the file... couldn't be found"
file_information = ExifTool.FileInfo(full_path)
Set ExifTool = nothing
End Function
Response.Write file_information(Server.MapPath("image.png"))
Output:
[
{
"SourceFile":"C:/inetpub/wwwroot/exiftool/image.png",
"ExifToolVersion":11.57,
"FileName":"image.png",
"Directory":"C:/inetpub/wwwroot/exiftool",
"FileSize":"4.5 MB",
"FileModifyDate":"2019:08:14 15:34:18+01:00",
"FileAccessDate":"2019:08:14 15:34:06+01:00",
"FileCreateDate":"2019:08:14 15:34:17+01:00",
"FilePermissions":"rw-rw-rw-",
"FileType":"PNG",
"FileTypeExtension":"png",
"MIMEType":"image/png",
"ImageWidth":1600,
"ImageHeight":1354,
"BitDepth":8,
"ColorType":"RGB with Alpha",
"Compression":"Deflate/Inflate",
"Filter":"Adaptive",
"Interlace":"Noninterlaced",
"ImageSize":"1600x1354",
"Megapixels":2.2
}
]
The files and installation instructions are available at: https://github.com/as08/ClassicASP.ExifTool

How to fix Errors with lists Length?

Help me please!
On the 3-rd step I got such errors as
Part 41 of ...... does not exist.
though on the previous steps it worked and returned results.
I've got lists of 40 elements in spkn,spkw,spmn,spmw and 41 in spx,spfn,spfw.
Code:
spx = {-2, -1.90577, -1.81153, -1.59327, -1.375, -1.35785, -1.3407, -1.24655, -1.22941, -1.11811, -0.934054, -0.80167, -0.75, -0.625,-0.5, -0.25, -0.0981238, 0.303752, 0.651876, 0.94833, 1, 1.5, 1.75,2.11731, 2.5, 2.5625, 2.625, 3.3125, 3.75, 4, 4.00964, 4.01928,4.25964, 4.36731, 4.5, 4.75, 5, 5.25, 5.5, 5.75, 6}
spkw = {105.056, 89.2249, 17.7361, 7.25929, 7.25929, 7.25929, 7.25929,1.09386, 1.09386, -7.35382, -12.5073, -11.929, -11.929, -15.429, -8.63312,-6.34314, -14.3807, -16.7907, -18.933, -12.3896, -3.021, -22.0262,-25.7865, -18.8033, -9.07591, -9.18036, -8.49959, -9.24378, -7.32337,-0.271835, -0.270096, 0.123206, 0.156523, 0.465142, 4.12922, 4.23318,8.03654, 8.20981, 12.1518, 12.3944}
spkn = {73.5426, 66.8007, 24.6942, 16.4029, 0.726929,0.314512, -1.23002, -1.23002, -3.90668, -10.8276, -14.2065,-13.0895, -18.656, -20.1709, -8.79676, -8.79676, -11.2319, -13.9771, -15.1407, -2.50312, -4.72374, -32.4496, -34.2958, -21.0455, -2.45882,-2.45882, -2.45882, -2.45882, -2.45882, -2.45882, -2.45882, -1.70357, -1.70357, -1.11799, 6.1251, 6.36752, 6.36752, 6.60995, 14.0955,14.5803}
spmw = {243.475, 213.305, 83.8004, 67.1081, 67.1081, 67.1081, 67.1081,59.4226, 59.4226, 49.9772, 45.1635, 45.6272, 45.6272, 43.4397,46.8376, 47.4101, 46.6214, 47.3535, 48.75, 42.5447, 33.1761,61.6839, 68.2644, 53.4787, 29.1603, 29.4279, 27.6409,30.1061,22.9045,-5.30161,-5.30859,-6.88938,-7.0313,-8.37913,-24.8675,-25.3613, -44.3781, -45.2877, -66.9686, -68.3634}
spmn = {180.448, 167.6, 91.3225, 78.1123, 56.5579, 55.9978, 53.9271,53.9271, 50.6364, 42.898, 39.742, 40.6374, 36.4626, 35.5158,41.2028, 41.2028, 40.9639, 41.7978, 42.5563, 30.5716, 32.7923,74.3811, 77.6119, 49.5569, 3.09017, 3.09017, 3.09017, 3.09017,3.09017, 3.09017, 3.09017, 0.0546329, 0.0546329, -2.5028,-35.0967, -36.2482, -36.2482, -37.5209,-78.6912, -81.4791}
spfn[[i]] = spkn[[i]]*spx[[i]] + spmn[[i]];
spfw[[i]] = spkw[[i]]*spx[[i]] + spmw[[i]];
spfw = {33.3632, 43.263, 51.6709, 55.5421, 57.1266, 57.2511, 57.3756,58.059, 58.0778, 58.1995, 56.846, 55.1903, 54.5739, 53.0828,51.1542, 48.9959, 48.0325, 42.2533, 36.408,30.7952,30.1551,28.6446,23.138,19.4168,6.47053,5.90328,5.32951, -0.513959, -0.750527, -6.38895, -6.39157, -6.39418,-6.36456, -6.09357, -6.28599, -5.25369, -4.19539, -2.18625, -0.133803,2.90414, 6.171}
spfn = {33.3632, 40.2933, 46.5882, 51.9781, 55.5583, 55.5708, 55.5762,55.4604, 55.4393, 55.0045, 530116,51.1309,50.4546,48.1226,45.6012,43.402,42.066,37.5522, 32.6864, 28.1979, 28.0685,25.7067, 17.5943,13.5547, -2.97428, -3.21054,-3.36422, -5.05466, -5.1301, -6.4392,-6.76879, -6.48231, -7.20196, -7.00719, -7.53373, -6.00246, -4.41058,-2.8187, -1.16621, 2.35765, 6.04694}
1-st step:
For[i = 1, i < Length#spfn, i++,
If[spfn[[i]]*spfn[[i + 1]] < 0 && spfw[[i]]*spfw[[i + 1]] < 0,
Print["1) exist roots: ", xnz[i] = -spmn[[i]]/spkn[[i]], ", ",
xwz[i] = -spmw[[i]]/spkw[[i]]] ;
Break[]
]
]
2-nd step:
For[i = 1, i < Length#spfn, i++,
If[(0 < spfn[[i]]) && (spfn[[i + 1]] < 0) && (0 < spfw[[i]]) && (0 <
spfw[[i + 1]]),
Print["2) exist roots:", xnz[i] = -spmn[[i]]/spkn[[i]], ", ",
spx[[i + 1]]] ;
Break[]
]
]
3-rd step(DOESN'T WORK):
For[i = 1, i < Length#spfn, i++,
If[(spfn[[i]] < 0) && (0 < spfn[[i + 1]]) && (0 < spfw[[i]]) && (0 <
spfw[[i + 1]]),
Print["3) exist roots:", xnz[i] = -spmn[[i]]/spkn[[i]], ", ",
spx[[i]]];
Break[]
]
]
THE RESULTS are:
1) exist roots: 5.58272, 5.511
2) exist roots:2.35475, 2.5
and errors:
Part::partw: Part 41 of {73.5426,66.8007,24.6942,16.4029,0.726929,0.314512,-1.23002,-1.23002,-3.90668,-10.8276,-14.2065,-13.0895,-18.656,-20.1709,-8.79676,-8.79676,<<8>>,-2.45882,-2.45882,-2.45882,-2.45882,-2.45882,-2.45882,-2.45882,-1.70357,-1.70357,-1.11799,6.1251,6.36752,6.36752,6.60995,14.0955,14.5803} does not exist. >>
Part::partw: Part 41 of {-2,-1.90577,-1.81153,-1.59327,-1.375,-1.35785,-1.3407,-1.24655,-1.22941,-1.11811,-0.934054,-0.80167,-0.75,-0.625,-0.5,-0.25,-0.0981238,0.303752,0.651876,0.94833,1,1.5,1.75,2.11731,2.5,2.5625,2.625,3.3125,3.75,4,4.00964,4.01928,4.25964,4.36731,4.5,4.75,5,5.25,5.5,5.75,6} does not exist. >>
and some more similar..
If you take the following out of your 'Code' section the rest executes without error messages.
spfn[[i]] = spkn[[i]]*spx[[i]] + spmn[[i]];
spfw[[i]] = spkw[[i]]*spx[[i]] + spmw[[i]];

Octave algorithm loop iteration

Can someone please tell me why this Octave algorithm does not execute the last iteration where i = 4 and j = 2? It seems to be affected by the break condition in the inner for-loop but this should not affect the last iteration.
x = [2, 3, 4];
h = [1, 2];
y = [0, 0, 0, 0];
for i = 1:4
for j = 1:2
printf("i = %d, j = %d\n", i, j);
if((i-j < 0) || (i-j > 2)) break; endif
y(i) = y(i) + h(j) * x(i-j+1);
endfor
endfor
I've tested it on my Debian system and it stops at i = 4 and j = 1. The output is:
i = 1, j = 1
i = 1, j = 2
i = 2, j = 1
i = 2, j = 2
i = 3, j = 1
i = 3, j = 2
i = 4, j = 1
What you probably want is:
for i = 1:4
for j = 1:2
if ((0 <= i-j) && (i-j <= 2))
printf("i = %d, j = %d\n", i, j);
y(i) = y(i) + h(j) * x(i-j+1);
endif
endfor
endfor
or
for i = 1:4
for j = 1:2
if ((i-j < 0) || (i-j > 2)) continue; endif
y(i) = y(i) + h(j) * x(i-j+1);
printf("i = %d, j = %d\n", i, j);
endfor
endfor
In your code, when i==4 and j==1 the statement
if((i-j < 0) || (i-j > 2)) break; endif
will jumps out of the innermost for loop. The outermost for loop is already completed (i==4) and the programs ends.
References:
continue statement
break statement
If you call "break", this is equally to jumping after the "endfor". So for i=4, j=1 (i-j) gets 3, you call "break" and i=4, j=2 never runs. See "continue" because I think this is what you want.
I ran your script in javascript. Here I have outputted the results of your condition. Seems like the scripts you have written performs as intended.
x = [2, 3, 4];
h = [1, 2];
y = [0, 0, 0, 0];
for(i=1; i<5;i++) {
for(j=1;j<3;j++) {
console.log('i'+i+" j"+j);
console.log('i -j > 2 '+(i -j > 2));
console.log('i-j < 0 '+(i-j < 0));
if((i-j < 0) || (i -j > 2)) { break;}
y[i] = y[i] + h[j] * x[i-j+1];
}
}
execute it in your chrome console to validate your the cases.

Getting table values once the for-do loop is over

I have coded the following function, to draw a grid on the screen (using FlyWithLua in X-Plane 10).
It works and paints the grid as it should, boxes/labels and everything, and obviously it creates the "lt_box" three dimensional array as when I print in the loop (the commented out print instructions) it prints the correct values.
The issue is, if I call lt_box[x][y][z] from any other part of the code I can't get to those values...
any idea?
function draw_lt_table()
idx = 1
idx2 = 1
xx1 = rth_box[1]
xx2 = rth_box[2]
yy1 = rth_box[3]
yy2 = rth_box[4]
lite_idx = 1
cell_x_size = 38
cell_y_size = 40
num_cols = 6
num_rows = 6
lt_box = {}
if d_tab==false or d_stg==false then
return lt_box
end
for idx2 = 1,num_rows,1 do
for idx = 1,num_cols,1 do
lt_box[idx] = {}
lt_box[idx][idx2] = {xx1+((cell_x_size*idx)-cell_x_size), xx1+(cell_x_size)*idx, 1+yy2+((cell_y_size*idx2)-cell_y_size), 1+yy2+(cell_y_size)*idx2}
graphics.set_color(0, 0, 0, 0.7)
graphics.draw_rectangle(lt_box[idx][idx2][1], lt_box[idx][idx2][3], lt_box[idx][idx2][2], lt_box[idx][idx2][4])
graphics.set_color(1, 1, 1, 0.7)
graphics.set_width(2)
graphics.draw_line(lt_box[idx][idx2][1],lt_box[idx][idx2][3],lt_box[idx][idx2][1],lt_box[idx][idx2][4])
graphics.draw_line(lt_box[idx][idx2][1],lt_box[idx][idx2][4],lt_box[idx][idx2][2],lt_box[idx][idx2][4])
graphics.draw_line(lt_box[idx][idx2][2],lt_box[idx][idx2][4],lt_box[idx][idx2][2],lt_box[idx][idx2][3])
graphics.draw_line(lt_box[idx][idx2][2],lt_box[idx][idx2][3],lt_box[idx][idx2][1],lt_box[idx][idx2][3])
light_up(unpack(lt_box[idx][idx2]))
glColor4f(1, 1, 1, 0.7)
draw_string(lt_box[idx][idx2][1]+12, lt_box[idx][idx2][3]+30, lite_idx)
draw_string(lt_box[idx][idx2][1]+3, lt_box[idx][idx2][3]+15, lites_vars[4][lite_idx])
draw_string(lt_box[idx][idx2][1]+3, lt_box[idx][idx2][3]+5, lites_vars[lt_set][lite_idx])
lite_idx = lite_idx+1 -- this is usd in line 115-116 to select values as labels
--[[
print("LT_BOX " .. idx .. " " .. idx2 .. " x1 ".. lt_box[idx][idx2][1])
print("LT_BOX " .. idx .. " " .. idx2 .. " x2 ".. lt_box[idx][idx2][2])
print("LT_BOX " .. idx .. " " .. idx2 .. " y1 ".. lt_box[idx][idx2][3])
print("LT_BOX " .. idx .. " " .. idx2 .. " y2 ".. lt_box[idx][idx2][4])
print("****************************************************************************")
--]]
end
--print("____________________________________________________________________________")
end
end
You have lt_box[idx] = {} in the inner loop, which means you reset that table every time you add an element. You have to create that table in the outer loop.
for idx = 1,num_cols,1 do
lt_box[idx] = {}
for idx2 = 1,num_rows,1 do

Resources