edgetx icon indicating copy to clipboard operation
edgetx copied to clipboard

pilot-lon, pilot-lan as table keys is very confusing on GPS sensor return

Open lshems opened this issue 4 years ago • 3 comments

https://doc.open-tx.org/opentx-2-3-lua-reference-guide/part_iii_-_opentx_lua_api_reference/general-functions-less-than-greater-than-luadoc-begin-general/getvalue

By having a key that contains a minus sign, 'pilot-lon' and 'pilot-lan', referencing the valus is really cumbersome:

getValue("GPS")["pilot-lan"] needs to be used now because getValue("GPS").pilot-lan will try to substract value for variable 'lan' from a value for key 'pilot' .

Why not change the labels to 'pilot_lon' and 'pilot_lan' and simply use getValue("GPS").pilot_lan ???

lshems avatar May 16 '21 15:05 lshems

Right, that sounds like an odd thing to do. I just hope we‘re not breaking someone else‘s code.

raphaelcoeffic avatar May 16 '21 15:05 raphaelcoeffic

made a typo: pilot_lat it should be of course.

In order not to break, just add the two extra useful labels.

;)

lshems avatar May 16 '21 15:05 lshems

Should this not be closed?

lshems avatar Nov 06 '25 22:11 lshems