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