From 21cb8e23e19d71049509bdda497baa5c182cd930 Mon Sep 17 00:00:00 2001 From: "p.kosyh" Date: Sat, 24 Jul 2010 17:34:41 +0000 Subject: [PATCH] protected call in ref --- stead/stead.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/stead/stead.lua b/stead/stead.lua index 9840fa3..1a6ec37 100644 --- a/stead/stead.lua +++ b/stead/stead.lua @@ -497,7 +497,11 @@ function ref(n) -- ref object by name return n; end if type(n) == 'function' then - return ref(n()); + local r,v = pcall(n); + if not r then + return nil + end + return ref(v); end return nil end