Module:Sandbox/Deryck Chan/rfdt

local rfd = {}

function rfd.test1 (frame) local test_string1 = frame.args[1] return test_string1 end

function rfd.test2 (frame) --this bit dumps a noinclude into the final output local test_string11 = frame.args[1] local test_string12 = frame.args[2] return test_string11 .. ' ' .. test_string12 .. ' ' end

function rfd.test3(frame) --this bit literally just dumps a human understandable safesubst string local linkstring = '' local anchorstring = ' ' return linkstring end

function rfd.test4(frame) return mw.title.getCurrentTitle end

function rfd.rfdt_collapsebox(frame) --this bit creates the "closed discussion" notice local message_string1 = ' ' .. "Closed discussion, click " local link_string = "#|here" local message_string2 = ' to view full discussion.' local result_string = '' if (frame.args[1]) then --this line doesn't work yet because Lua evaluates an empty string as true result_string = ' Result was: ' .. frame.args[1] end local end_string = ' '

return message_string1 .. link_string .. message_string2 .. result_string .. end_string end

function rfd.rfdb_noinclude(frame) return ' ' end

function rfd.generate_icon(frame) local function match_result(result_parameter) local find_count = 0 local result_match = '' local parameter_lower = result_parameter:lower if (parameter_lower:find('keep')) then result_match = 'Keep' find_count = find_count + 1 end if (parameter_lower:find('delete')) then result_match = 'Delete' find_count = find_count + 1 end if (parameter_lower:find('retarget')) then result_match = 'Retarget' find_count = find_count + 1 end if (parameter_lower:find('disambiguate') or parameter_lower:find('dab') or parameter_lower:find('sia') or parameter_lower:find('set index')) then result_match = 'Disambiguate' find_count = find_count + 1 end if find_count >= 2 then result_match = 'Multiple' elseif find_count <= 0 then result_match = 'None' end return result_match, 'lalala' end local result_string1, result_string2 = match_result(frame.args[1]) return result_string1 .. 'abcd' .. result_string2 end

return rfd