mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-06 08:46:53 +08:00
These demonstrate the global scope of namespaces, defining functions and variables within namespaces, and namespace nesting by copy or reference.
9 lines
158 B
ChaiScript
9 lines
158 B
ChaiScript
namespace("parent")
|
|
namespace("child")
|
|
|
|
child.x = 3.0
|
|
parent.child := child
|
|
parent.child.x = 5.0
|
|
|
|
assert_equal(5.0, child.x)
|
|
assert_equal(5.0, parent.child.x) |