Notifications
Clear all
[Closed] A rename object question
Sep 05, 2009 1: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”
2 Replies
Sep 05, 2009 1:45 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