On Sat, 11 Jun 2005, federico wrote:
is possible to convert a symbol to int? i have a number into a symbol, and: [symbol (5442)] but when i bang the symbol object pd says: error: Bad arguments for message 'set' to object 'nbx' is there a specific object to do this?
pd -lib gridflow
and put this external in your ~/.gridflow_startup :
GridFlow::FObject.subclass("atof",1,1) { def _0_symbol s m = /[-+0-9.eE]+/ .match s.to_s send_out 0, Float(m[1]) end }
This is a [atof] external which will extract the first numeric string in a symbol message and output the corresponding float.
note: I didn't test the above code, so if someone tells me it doesn't work, I'll correct the typos. (my computer just blew up so I don't have access to PureData at the moment)
,-o--------o--------o--------o-. ,---. irc.freenode.net #dataflow |
| The Diagram is the Program tm| | ,-o-------------o--------------o-.
-o------------o-------------o-' | | Mathieu Bouchard (Montréal QC) | | téléphone:+1.514.383.3801
---' `-o-- http://artengine.ca/matju -'