Модуль:StrLen
Материал из GeologyScience Wiki
Для документации этого модуля может быть создана страница Модуль:StrLen/doc
local p = {} function p.len( str1 ) local str2 = str1.args[1] local result = '' result = string.len(str2) return result end --[[ function p.req() local result = '' result = mw.ext.externalData.getDbData{ db="DSpace", from="metadatavalue = a,metadatavalue = b", where="a.text_value like '%ARSENOP%' AND a.metadata_field_id = 70 and b.metadata_field_id = 31 and a.dspace_object_id=b.dspace_object_id ", data="Paper_name=a.text_value, Paper_link=a.dspace_object_id" } return result end --]] local cargo = mw.ext.cargo function p.Main( frame ) local tables = 'DS_name' local fields = 'Name=name1, Link=link1' -- optional parameters are grouped in one table -- you can omit any or all of them, except join if you use more than one table local args = {} --[[ where = 'table1.fieldE="some value", etc.', join = 'table1.fieldA = table2.fieldB,table2.fieldC=table3.fieldD, etc.', groupBy = 'table1.fieldG', having = 'table1.fieldG="some value", etc.', orderBy = 'table2.fieldF, etc.', limit = some number, offset = some number, } --]] local results = cargo.query( tables, fields, args ) for r = 1, #results do local result = results[r] -- Do something with the result table, e.g. result.alias1 return result.name1, result.link1 end return 'The end' end return p