webmcp
diff framework/env/slot/select.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/slot/select.lua Sun Oct 25 12:00:00 2009 +0100 1.3 @@ -0,0 +1,18 @@ 1.4 +--[[-- 1.5 +slot.select( 1.6 + slot_ident, -- name of a slot 1.7 + function() 1.8 + ... -- code to be executed using the named slot 1.9 + end 1.10 +) 1.11 + 1.12 +This function executes code in a way that slot.put(...) and other functions write into the slot with the given name. Calls of slot.select may be nested. 1.13 + 1.14 +--]]-- 1.15 + 1.16 +function slot.select(slot_ident, block) 1.17 + local old_slot = slot._active_slot 1.18 + slot._active_slot = slot_ident 1.19 + block() 1.20 + slot._active_slot = old_slot 1.21 +end