Q: How to check the type of a variable?
-
Is there a way to check the type of a variable? Something like
typeof(global.fanSpeed)
and result would bebool
,int
,float
,string
,DateTime
,object
orarray
If this is not possible atm, can you please add this feature? It will help a lot with params validation
-
@AndMaz I'm sorry, we don't currently provide a way to check the type of a variable, other than to check if it is null. Can you provide more details about the use case?
-
@dc42 I would like to validate the input before doing any actual printing. For example, in
M98 P"my-macro.g" S100 Y"123"
the Y value is passed as astring
instead of aint
. -
@AndMaz I creates this github issue https://github.com/Duet3D/RepRapFirmware/issues/865.