ScriptSpot

Forum topic · General Scripting

Does exist a simple way to remove variables?

By Arahnoid · 2012-01-13

Description

Maybe somebody know a simple way to remove variables what was created during the script testing for example if you create rollout


rollout rl_test "Some Rollout" width:100 height:100
(
  checkbutton myButton "My Button" width:80 height:24
)
createDialog rl_test

if I execute code bellow before rollout is created


rl_test.myButton.state

then I get
-- Unknown property: "myButton" in undefined
and this is fine because max doesn't know about such a rollout and button

but after rollout was created it always returns some value even if rollout was closed. Maybe are some smart way to clear this data from Max memory without restarting Max.

Comments (1)

var = undefined

Anubis · 2012-01-14

the simplest way is just to set your variable to undefined --

rl_test = undefined

that not remove those variable from the global space memory, but its quite enough for testing, and to remove them completely you can use

globalVars

structore --

if globalVars.isglobal "rl_test" do globalVars.remove "rl_test"

But read the notes about globalVars in the help, Cheers!