diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-08-05 10:55:23 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-08-05 10:55:23 +0100 |
commit | 5d273ba981d3717adecbe68a433191f3d3667c7a (patch) | |
tree | a138ea510a82514ef30de371c248747292780245 | |
parent | 08c1d439d1cb3de7687cb9613fef315bf33b9b54 (diff) | |
download | supple-5d273ba981d3717adecbe68a433191f3d3667c7a.tar.gz |
SUPPLE: Ensure __next is set on proxied tables by default
-rw-r--r-- | lib/supple/comms.lua | 5 | ||||
-rw-r--r-- | lib/supple/objects.lua | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/supple/comms.lua b/lib/supple/comms.lua index 639ce33..ef44666 100644 --- a/lib/supple/comms.lua +++ b/lib/supple/comms.lua @@ -160,6 +160,11 @@ local function wait_for_response() obj[back.args[1]] = back.args[2] return {} end) + elseif back.method == "__next" then + safe_method(function() + local obj = objects.receive { tag = back.object } + return {next(obj, back.args[1])} + end) else safe_method(function() local obj = objects.receive { tag = back.object } diff --git a/lib/supple/objects.lua b/lib/supple/objects.lua index 9220502..5a5dfca 100644 --- a/lib/supple/objects.lua +++ b/lib/supple/objects.lua @@ -129,6 +129,7 @@ local function receive(obj) obj.methods[#obj.methods+1] = "__len" obj.methods[#obj.methods+1] = "__index" obj.methods[#obj.methods+1] = "__newindex" + obj.methods[#obj.methods+1] = "__next" end for _, name in ipairs(obj.methods or {}) do local function meta_func(mobj, ...) |