jbe/bsw@0: --[[-- jbe/bsw@0: slot_content = jbe/bsw@0: slot.use_temporary( jbe/bsw@0: function() jbe/bsw@0: ... jbe/bsw@0: end jbe/bsw@0: ) jbe/bsw@0: jbe/bsw@0: This function creates a temporary slot and executes code in a way that slot.put(...) and other functions will write into the temporary slot. Afterwards the contents of the temporary slot are returned as a single string. jbe/bsw@0: jbe/bsw@0: --]]-- jbe/bsw@0: jbe/bsw@0: function slot.use_temporary(block) jbe/bsw@0: local old_slot = slot._active_slot jbe/bsw@0: local temp_slot_reference = {} -- just a unique reference jbe/bsw@0: slot._active_slot = temp_slot_reference jbe/bsw@0: block() jbe/bsw@0: slot._active_slot = old_slot jbe/bsw@0: local result = slot.get_content(temp_slot_reference) jbe/bsw@0: slot.reset(temp_slot_reference) jbe/bsw@0: return result jbe/bsw@0: end