ark1320 Posted December 20, 2018 Report Posted December 20, 2018 Hello Pete, Does n= ipc.readLvar() assume a particular data format for the value n read (byte, word, floating point, etc), or does it just default to the Lvar's format? I'm asking because if I read an Lvar value and then want to write it to an offset with ipc.writeXX(0x1234, n), I need to decide what XX is (UB, SW, DBL, etc). Best for the holidays, Al
Pete Dowson Posted December 20, 2018 Report Posted December 20, 2018 1 hour ago, ark1320 said: Does n= ipc.readLvar() assume a particular data format for the value n read (byte, word, floating point, etc), or does it just default to the Lvar's format? It actually arrives as a double float (FLOAT64), which is just a number in Lua's terms. There's only one "number" type in Lua, so it is something you don't need to worry about. 1 hour ago, ark1320 said: I'm asking because if I read an Lvar value and then want to write it to an offset with ipc.writeXX(0x1234, n), I need to decide what XX is (UB, SW, DBL, etc). Well, that depends on what sort of values you expect or want to deal with. Lua numbers are all floating point and therefore also signed, but many applications of L:Vars are neither -- eg plain 0 and 1 for OFF/ON. but 0 and 1 will stil be okay whether signed or unsigned and whether fixed point orfloating point. In other words it is your choice what you want to see in your offset. If you elect for fixed point and there are fractions, FSUIPC will round it to the nearest whole number. But a negative number stored as unsigned will look to you are a very large positiive number). Hope this is clear? Pete
ark1320 Posted December 20, 2018 Author Report Posted December 20, 2018 Yes, I understand. I'm familiar with negative number representation. Thanks, Al
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now