Maybe this will help you or other members:
####main.lua####
[lua]local found
local min
–Here I define a table
–You can use what value you want for you
local t={3, -200, -91, 7, 4}
–the main function
function main()
–with this function you will found the elemeen that you want to increase his value
local function increaseMe()
–first we compose a basic function that find the minimun value between 2 parameters a, b
–we use this function later
local function minim(a, b)
if a **return a
else
return b
end
end
–we create a function here that look in a generic table to find the minimum element in it
–we use in it the minim function
local function foundMin(table1)
for i=1,#table1 do
found=table1[1]
for j=2,#table1 do
found=minim(found,table1[j])
end
return found
end
end
–here we apply this function to our table an print the minimum value from it
min=foundMin(t)
–this is the final result of the function increaseMe
print(“The min value is :”…min)
end
–we load this function
increaseMe()
–after you found the minimum value , you look in the defined table to this value
for i=1,#t do
if min==t[i] then
–Here I suppose is what you are looking for
print (“You must increase the value of t[”…i…"]= “…t[i]…” with 1 unit")
end
end
end
main()[/lua] [import]uid: 65047 topic_id: 16633 reply_id: 62478[/import]**