robotpy / pynetworktables

Pure python implementation of the FRC NetworkTables protocol
Other
60 stars 30 forks source link

Added method to NetworkTable class to check for value type associated… #75

Closed amorygalili closed 5 years ago

amorygalili commented 5 years ago

… with a key. Using pynetworktables2js I'm not able to tell what type an empty array is (whether it's a string, bool, or number array), so I want to send the type of the variable along with its value and key through the websocket.

virtuald commented 5 years ago

I think you can already do this with NetworkTables.getEntry(name).getType()

virtuald commented 5 years ago

Anyways, for pynetworktables2js, what you really want is the underlying value/entry to be passed to you (since the caller already has it), instead of dereferencing it. Maybe add another flag to the entry listener instead, that passes the callback the value (which has the type available) instead.

virtuald commented 5 years ago

Actually, it looks like it's already there, if you don't specify paramIsNew: https://github.com/robotpy/pynetworktables/blob/59b5d1328274e78393202fe2a7e09845f5ff63a5/networktables/networktable.py#L170

virtuald commented 5 years ago

... which, that's actually a bug. Probably should be documented.