From c356322a3c1b7594f77c77e8dbb42cfb0f9aad20 Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Tue, 29 Jun 2010 13:18:03 +0000
Subject: [PATCH] xroom added for lazy peoples ;)
---
stead/xact.lua | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/stead/xact.lua b/stead/xact.lua
index 8411438..bcec3d5 100644
--- a/stead/xact.lua
+++ b/stead/xact.lua
@@ -107,3 +107,18 @@ function xdsc(n)
end
return obj(v)
end
+
+default_xdsc_obj = xdsc();
+
+xroom = stead.hook(room, function(f, v, ...)
+ if type(v) == 'table' then
+ if v.obj == nil then
+ v.obj = {}
+ elseif type(v.obj) ~= 'table' then
+ error("Wrong parameter to xroom.", 2);
+ end
+ -- we not use put here, to force saver do not save all list
+ stead.table.insert(v.obj, 1, 'default_xdsc_obj');
+ end
+ return f(v, unpack(arg))
+end)