diff options
Diffstat (limited to 'spec/outputs/with_scope_shadow.lua')
| -rw-r--r-- | spec/outputs/with_scope_shadow.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/outputs/with_scope_shadow.lua b/spec/outputs/with_scope_shadow.lua new file mode 100644 index 0000000..72abe95 --- /dev/null +++ b/spec/outputs/with_scope_shadow.lua | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | local target = { | ||
| 2 | val = 1, | ||
| 3 | add = function(self, n) | ||
| 4 | self.val = self.val + n | ||
| 5 | return self.val | ||
| 6 | end | ||
| 7 | } | ||
| 8 | local result | ||
| 9 | do | ||
| 10 | local val = 100 | ||
| 11 | add(2) | ||
| 12 | result = target | ||
| 13 | end | ||
| 14 | return print(result, target.val) | ||
