webmcp
diff framework/env/slot/get_content.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/get_content.lua Sun Oct 25 12:00:00 2009 +0100 1.3 @@ -0,0 +1,20 @@ 1.4 +--[[-- 1.5 +content = 1.6 +slot.get_content( 1.7 + slot_ident -- name of the slot 1.8 +) 1.9 + 1.10 +This function returns the content of a chosen slot as a single string. 1.11 + 1.12 +--]]-- 1.13 + 1.14 +function slot.get_content(slot_ident) 1.15 + local slot_data = slot._data[slot_ident] 1.16 + if #slot_data.string_fragments > 1 then 1.17 + local str = table.concat(slot_data.string_fragments) 1.18 + slot_data.string_fragments = { str } 1.19 + return str 1.20 + else 1.21 + return slot_data.string_fragments[1] or "" 1.22 + end 1.23 +end