Module:Extract text: Difference between revisions

From Caves of Qud Wiki
Jump to navigation Jump to search
(Created page with "local ExtractText = {} function ExtractText.from_parentheses(frame) local match_result = frame.args[1]:match'%((.*)%)' if match_result == nil then error'The text did no...")
 
(this might be more useful)
Line 5: Line 5:
if match_result == nil then
if match_result == nil then
error'The text did not contain parentheses.'
return nil
else
else
return match_result
return match_result

Revision as of 23:05, 13 December 2020

Documentation for this module may be created at Module:Extract text/doc

local ExtractText = {}

function ExtractText.from_parentheses(frame)
	local match_result = frame.args[1]:match'%((.*)%)'
	
	if match_result == nil then
		return nil
	else
		return match_result
	end
end

return ExtractText