webmcp
diff framework/env/param/restore.lua @ 0:9fdfb27f8e67
Version 1.0.0
author | jbe/bsw |
---|---|
date | Sun Oct 25 12:00:00 2009 +0100 (2009-10-25) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/framework/env/param/restore.lua Sun Oct 25 12:00:00 2009 +0100 1.3 @@ -0,0 +1,16 @@ 1.4 +--[[-- 1.5 +param.restore() 1.6 + 1.7 +Calling this function reverts the changes of param.exchange(...). It should not be called explicitly, but is used implicitly, if you pass an 'id' or 'params' option to execute.view{...} or execute.action{...}. 1.8 + 1.9 +--]]-- 1.10 + 1.11 +function param.restore() 1.12 + local saved = param._saved 1.13 + local previous = saved[#saved] 1.14 + saved[#saved] = nil 1.15 + if previous == nil then 1.16 + error("Tried to restore id and params without having exchanged it before.") 1.17 + end 1.18 + param._exchanged = previous 1.19 +end