localexport={}functionexport.exists(frame)localargs=frame.argslocalsc=args[1]orerror("Script code has not been specified. Please pass parameter 1 to the module invocation.")sc=require("Module:scripts").getByCode(sc)ifscthenreturn"1"elsereturn""endendfunctionexport.getByCode(frame)localargs=frame.argslocalsc=require("Module:scripts").getByCode(args[1],1,"disallow nil")returnrequire("Module:language-like").templateGetByCode(sc,args,function(itemname)ifitemname=="countCharacters"thenlocaltext=args[3]or""returnsc:countCharacters(text)endend)endfunctionexport.getByCanonicalName(frame)localargs=frame.argslocalsc=args[1]orerror("Script name (parameter 1) has not been specified.")sc=require("Module:scripts").getByCanonicalName(sc)ifscthenreturnsc:getCode()elsereturn"None"endendfunctionexport.findBestScript(frame)localargs=frame.argslocaltext=args[1]orerror("Text to analyse (parameter 1) has not been specified.")locallang=args[2]orerror("Language code (parameter 2) has not been specified.")localforce_detect=args.force_detect;ifforce_detect==""thenforce_detect=nilendlocalgetCanonicalName=args[3]=="getCanonicalName"localsc=require("Module:languages").getByCode(lang,true):findBestScript(text,force_detect)ifgetCanonicalNamethenreturnsc:getCanonicalName()elsereturnsc:getCode()endendreturnexport