PDA

View Full Version : A rename object question


su37
09-05-2009, 12:45 PM
Hi all,
I have a question,I made a function, but running it returns different results,I want to get help

fn Rename_tex thename =
(
IF $.material != undefined then
$.material.name = thename as string
$.name = thename as string
)

Rename_tex 11
Rename_tex abc
returns
"11"
"undefined"
Why "undefined"

DreaTawn
09-05-2009, 01:44 PM
To Max, abc looks like a variable, but there's no variable called abc defined in your code. So when you say Rename_tex abc, mxs silently passes undefined to your function. Then, in your function, you convert the incoming parameter to string so you get "undefined".

Try Rename_tex "abc" instead.

Cheers,

Drea

su37
09-06-2009, 12:52 AM
I understand, thanks DreaTawn

CGTalk Moderation
09-06-2009, 12:52 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.