FHUG Home
Knowledge Base Home
FHUG Downloads
Contributing Your Knowledge
How To Guides:
Cross References:
This is an old revision of the document!
Using either the Store Id or the Plugin Name (title) or Plugin Filename retrieves the current Plugin Store version. The current plugin filename can be obtained using fhGetContextInfo('CI_PLUGIN_NAME')
Requires: luacom
require('luacom') function checkVersionInStore(type,value) --[[ @description: Checks the version in the plugin store by name or id @Parms: 1: String, must be either 'id' or 'name' or file 2: String where name search or number where id search @Returns: 1: nil where value not found or parameter 1 is invalid, or the value of the plugins version field ]] if type ~= 'id' and type ~= 'name' and type ~= 'file' then return nil end if value then local http = luacom.CreateObject("winhttp.winhttprequest.5.1") strRequest ='http://www.family-historian.co.uk/lnk/checkpluginversion.php?'..type..'='..value http:Open("GET",strRequest,false) http:Send() local strReturn = http.Responsebody local ver = '' local ref = '' if strReturn ~= nil then ver,ref = strReturn:match('(%d.*),(%d*)') end return ver,ref else return nil end end
pluginname = fhGetContextInfo('CI_PLUGIN_NAME')..'.fh_lua' version,reference = checkVersionInStore('file',pluginname) print(pluginname,version,reference) print(checkVersionInStore('id',199)) print(checkVersionInStore('name','Timeline Chart'))
Section plugins:code_snippets