Cing, on 26 September 2015 - 01:24 PM, said:
Look up the exp value in your tank against the table (exp column) and compare with the level column.
The 'exp from last' column is useless to you.
I would put all the values into a
lookup table and have my program use that. I'd put the level in the index of the table with the exp as the value of that index, the program would crawl through the table until it finds an index with a exp value more than the amount of exp in the container. The amount of levels in the container are then equal to the index of the table that I stopped at minus one.
local levelToExpLookupTable = {7,16,27,} --#you will have to fill the rest of the table
local function getLevelFromExp(exp)
local currentIndex = 1
while levelToExpLookupTable[currentIndex] <= exp do
currentIndex = currentIndex + 1
end
return currentIndex - 1
end
Edited by Lupus590, 26 September 2015 - 01:50 PM.