lua-users home
lua-l archive

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


Hi,

This works quite well, but I would like to write a new
application where I send strings from Lua and receive floats back.

If you control both sides of the communication, i.e., the
daemon and the client, and if you know the floating-point
format used by them is the same, it is trivial to solve this
problem.

Just add a C function that converts a float to its binary
representation in a string, and another that does the
opposite. You can then send these strings back and forth.
Of course, the type of data you are sending back and forth
should be somehow implicit or explicit in your protocol.

Otherwise, I know of no better solution.

Regards,
Diego.

PS: It is unlikely receive() will support anything but
strings, since it wouldn't be portable enough to be widely used.