findPackage() returns the Package object of the specified name. If the package does not exist it returns null.
findPackage("foo") ==> null
package("foo") ==> package "foo"
package("")
findPackage("foo") ==> package "foo"
package() ==> package ""
getPackage() returns the Package object of the specified name. If it does not exist it creates one and return it.
package() ==> package ""
findPackage("bar") ==> null
getPackage("bar") ==> package "bar"
package() ==> package ""
createPackage() creates and returns an anonymous package.
# of parameters The types The action 1 java.lang.String Evaluate the string in a package 1 java.lang.Object[] Interpret each element as a [key, value] pair and define them in a package any any If there is any function in the parameters, register the function with its name in a package.
p = createPackage()
p.x = 1
p.y = 2
q = createPackage("x = 1; y = 2")
q.x ==> 1
q.y ==> 2
r = createPackage([["a", "hello"], ["b", "world"]])
r.a ==> "hello"
r.b ==> "world"
Unlike ordinary functions, createPackage() evaluates its parameters with the caller's context. See also "Script Package".
removePackage() removes the specified package.
rootScope() returns the topmost package of the package hierarchy, which is usually the global package.