diff options
author | Yotam Doron <ydoron@google.com> | 2016-01-07 13:53:26 +0300 |
---|---|---|
committer | Yotam Doron <ydoron@google.com> | 2016-01-07 13:53:26 +0300 |
commit | 6e8404dc8ec394347950677a5142422e3ec9ae59 (patch) | |
tree | e5e0cfb6f20bb9a0660e6501bd5a121d155e8119 | |
parent | 2adabfa57361ff6783134d275cf5c0a6536620d3 (diff) |
Fix small discrepancy between closure example and output.
-rw-r--r-- | doctutorial/README.md | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/doctutorial/README.md b/doctutorial/README.md index ce0a144..e771f56 100644 --- a/doctutorial/README.md +++ b/doctutorial/README.md @@ -242,15 +242,15 @@ for i = 1,4 do end t7> myfuncs[1]() -1 +this function has been called 1 times t7> myfuncs[1]() -2 +this function has been called 2 times t7> myfuncs[4]() -1 +this function has been called 1 times t7> myfuncs[4]() -2 +this function has been called 2 times t7> myfuncs[1]() -3 +this function has been called 3 times ``` You can use such closures to create objects on the fly, that is, tables which combine functions and data to act upon. Thanks to closure, data can live in arbitrary locations (not necessarily the object's table), and simply be bound at runtime to the function's scope. |