lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,

I have an associative array to store upcoming events like :
tbl[ time ] = function_to_trigger()

where time is a numerical value like 12.30 for 12:30 (I know there is better time representation but it's to make user interface easier).

Some time, the key is not found in the array like in this log :

2016-10-19 11:21:00 - *d* tmrSubFunc(11.21) 
    Time to launch something,

2016-10-19 11:21:00 - *d* ->nil
    but tbl[time]  is not found

2016-10-19 11:21:00 - *d* arg : 11.21 / number
    the index to find out.

Dump of the table :

2016-10-19 11:21:00 - *d* tbl :(number)1 = {
  (number)1 = "function: 0x16aca18"
}
(number)18.42 = {
  (number)1 = "function: 0x16c1cd0"
  (number)2 = "function: 0x16bfbc0"
  (number)3 = "function: 0x16c3a20"
}
(number)8.05 = {
  (number)1 = "function: 0x16bfe28"
}
(number)11.21 = {
  (number)1 = "function: 0x16ad830"
}


As you can see, an entry for 11.21 exists but is not found.
I suspect a (deep) rounding issue as the argument come from a calculation ... but is only a guess.

Does someone faced such issue ? And any workaround ?

Thanks

Laurent
 
The misspelling master is on the Web.   _________ 100 % Dictionnary Free ! /                    /( / Dico          / / Pleins d'autres fautes sur /________ / / (########( / http://destroyedlolo.info Quoi, des fautes d'orthographe! Pas possible ;-D.