From 6e8404dc8ec394347950677a5142422e3ec9ae59 Mon Sep 17 00:00:00 2001 From: Yotam Doron Date: Thu, 7 Jan 2016 10:53:26 +0000 Subject: Fix small discrepancy between closure example and output. --- doctutorial/README.md | 10 +++++----- 1 file 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. -- cgit v1.2.3