local ExtUtils = {} function ExtUtils.slurpFile( name ) local f = assert( io.open( name, "rb" ) ) local content = f:read( "*all" ) f:close() return content end function getManifest() local fn = Helix.Core.Server.GetArchDirFileName( "manifest.json" ) return cjson.decode( ExtUtils.slurpFile( fn ) ) end function trim( s ) return ( s:gsub( "^%s*(.-)%s*$", "%1" ) ) end function getICfg() local cfg = {} for k, v in pairs( Helix.Core.Server.GetInstanceConfigData() ) do cfg[ k ] = trim( v ) end return cfg end ExtUtils.manifest = {} ExtUtils.iCfgData = {} function ExtUtils.init() if ExtUtils.iCfgData[ "specName" ] == nil then ExtUtils.iCfgData = getICfg() -- todo: split the user list into another table end if ExtUtils.manifest[ "key" ] == nil then ExtUtils.manifest = getManifest() end end return ExtUtils
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 30808 | C. Thomas Tyler |
Promoted from 2019.1/... to main/... |
||
//guest/perforce_software/extensions/2019.1/validate_field_size/ExtUtils.lua | |||||
#1 | 25601 | Jason Gibson |
Import example Extensions. p19.1@1797741 |