Notifications
Clear all

[Closed] Cast string the function

Obviously, not possible, but what I’m trying to do is find functions with particular names (using getPropNames), and then invoking them. I can do this with execute, but I’d much rather get the functions themselves. Is there anyway to do this?

5 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

function of what? interface, structure, dotnet object, dotnet class,…?

maxscript struct

How about this :

– returns an array of your property names
yourProps = getPropnames yourStruct

– code for the functionname searching in yourProps array is missing here
[…FUNCTION SEARCH CODE…]
– let’s asume we found our function name at index 3
yourFoundFunc = getproperty yourStruct ( yourProps[3])

– now “yourFoundFunc” holds the MAXScriptFunction value and is callable
yourFoundFunc()

– problem might be that you still don’t know the expected argument count of that function

1 Reply
(@duke)
Joined: 11 months ago

Posts: 0

That’s exactly what I was after – thanks!

You can also use the resulting string from

apropos "yourStruct"

which will also let you see private functions/variables.

The resulting string can be sent to a stringstream for further manual parsing.
I use that to generate an autocompletion file for notepad++ as external editor.

PS: Ok, I read the initial post again and I’m totally out of the initial subject here :). This method is not efficient at all in your case. I let the post anyway because it can be useful to anybody interested in notepad++ and autocompletion