Home AMX User Forum NetLinx Studio

Variable_To_String

I was just having a look at what Variable_To_String actually does, it seems to convert the passed variable/array/struct to a string in big endian form with tokens, I ran a few tests to try and find what each token meant...

E1 Char
E2 WideChar, Integer, Sinteger
E3 Long, Slong, Float
E4 Double
E5 Char Array
E6 WideChar Array, Integer Array, Sinteger Array
E7 Long Array, Slong Array, Float Array
E8 Double Array
E9
EA Structure Start
EB Structure End
EC Structure Array

Does anyone know if there are any more tokens?
It would be useful for many reasons to know, e.g. stripping the tokens so I can pass a struct to the network, or perform the inverse of a Raw_BE by inserting the relevant token and using String_To_Variable....

Comments

  • ericmedleyericmedley Posts: 4,177
    That's an interesting question.

    The typical use for Var_to_string and it's other cousins Var_to_XML and whatnot is to move variable's values to/from a program into a data file stored on the master or other server.

    I do this for really big data sets like DirecTV channel lineups where I want to treat the data like a non-volatile variable but don't want to hog all the non-vol memory.
  • PhreaKPhreaK Posts: 966
    When all else fails... read the manual. Sounds like you'd be one of those geeky folk that would enjoy the exciting literature contained in Appendix A of the NetLinx Language Reference Guide. It's got the full marshalling protocol used by the encode and decode functions.

    Check out the NCL math library to see it in action.
    </shameless plug>
  • Spire_JeffSpire_Jeff Posts: 1,917
    Just to add to the discussion.... I had some REALLY bad experiences with variable_to_string and variable_to_xml. They are supposedly fixed now, but even the "standard based" xml output is all but useless for editing efficiently outside of the processor. I wrote my own functions to read and write data to XML files, unfortunately, I have to change it based on the structure and it is not as efficient as the native functions.

    I am thinking that Duet would be better at this, but I am the weak link in using duet right now :(

    Jeff
  • YarmYarm Posts: 6
    PhreaK wrote: »
    When all else fails... read the manual. Sounds like you'd be one of those geeky folk that would enjoy the exciting literature contained in Appendix A of the NetLinx Language Reference Guide. It's got the full marshalling protocol used by the encode and decode functions.

    Check out the NCL math library to see it in action.
    </shameless plug>

    wow! thats awsome, thanks!
  • ericmedleyericmedley Posts: 4,177
    Spire_Jeff wrote: »
    Just to add to the discussion.... I had some REALLY bad experiences with variable_to_string and variable_to_xml. They are supposedly fixed now, but even the "standard based" xml output is all but useless for editing efficiently outside of the processor. I wrote my own functions to read and write data to XML files, unfortunately, I have to change it based on the structure and it is not as efficient as the native functions.

    I am thinking that Duet would be better at this, but I am the weak link in using duet right now :(

    Jeff

    I do think they have the bugs fixed for the most part. The key is indeed staying in the Netlinx sandbox. Once you stray away from there and try and edit/manipulate the xml or .txt docs with other stuff all bets are off.

    I've forced myself to resist the urge to play outside the sandbox. I juse use it as I described before and have had pretty good luck. Keep telling yourself, "It's just for storying variables, It's just for storying variables,
    It's just for storying variables,..."

    :D
Sign In or Register to comment.