|
Post by willingtolearnnewbie on Mar 11, 2020 14:44:43 GMT
Hi sirs, goodday, i cant seem to find something related to table sorting and executing functions based on table contents numerical order.
I made script like this
Local vacantA = regionFindAllNoFindException(reg, "img.png") Local vacantB = regionFindAllNoFindException(reg, "img.png") Local vacantC = regionFindAllNoFindException(reg, "img.png")
Toast ("image found in A is " .. #vacantA) Toast ("image found in B is " .. #vacantB) Toast ("image found in C is " .. #vacantC)
I want to create table containing the counts of each vacant table, and then order them ascending, and execute a function based on what is highest to lowest, please help, im stuck with this
|
|
|
Post by AnkuLua on Mar 12, 2020 0:34:03 GMT
|
|
|
Post by willingtolearnnewbie on Mar 21, 2020 17:48:28 GMT
Thanks for answering sir, i know now how to make a table then arrange the values inside, but how could i execute a function based on what is the highest, middle, and lowest value in the table? If i have 3 keys, A, B, C If B is higher than A and C then execute function If A is higher than B and C then execute function, How would i write this in a code?
|
|
|
Post by AnkuLua on Mar 21, 2020 23:28:35 GMT
Thanks for answering sir, i know now how to make a table then arrange the values inside, but how could i execute a function based on what is the highest, middle, and lowest value in the table? If i have 3 keys, A, B, C If B is higher than A and C then execute function If A is higher than B and C then execute function, How would i write this in a code? if (#vacantA > #vacantB and #vacantA > #vacantC) then funcA() elseif (#vacantB > #vacantA and #vacantB > #vacantC) then funcB() else funcC() end
|
|