Notifications
Clear all
[Closed] Get the result/value of format
Mar 13, 2017 6:14 pm
How do I get the result of from the format function? This seems more simpler and easier to understand than concatenating strings.
e.g.
obj = $
testString = "My name is " + obj.name + "and I'm a " + (classof obj) + ". The end"
testFormat = format "My name is % and I'm a %. The end" obj.name (classof obj)
4 Replies
Mar 13, 2017 6:14 pm
format and print function are methods from WindowStream class, which means they need a stream output to pipe their result.
The output stream by default is obviously the MaxScript Listener Window, but you can specify another one using “to:” parameter.
testFormat = stringstream ""
format "My name is % and I'm a %. The end" obj.name (classof obj) to:testFormat
Mar 13, 2017 6:14 pm
print <value> to:<filestream>
format <fmt_string> { <value> } to:<filestream>
check out mxs reference
Mar 13, 2017 6:14 pm
never read this stringstream and the mxs documentation doesn’t connected with it…
thanks…
1 Reply