diff options
Diffstat (limited to 'acf/util.lua')
-rw-r--r-- | acf/util.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/acf/util.lua b/acf/util.lua index cbea072..9788c81 100644 --- a/acf/util.lua +++ b/acf/util.lua @@ -1,10 +1,15 @@ --[[ -Copyright (c) 2012 Kaarle Ritvanen +Copyright (c) 2012-2013 Kaarle Ritvanen See LICENSE file for license details --]] module(..., package.seeall) +function setdefault(t, k, v) + if t[k] == nil then t[k] = v end + return t[k] +end + function setdefaults(dst, src) for k, v in pairs(src) do if dst[k] == nil then dst[k] = v end end return dst |