Lua:Neutrino-API:checkVersion:en

Aus TuxBoxWIKI
Wechseln zu: Navigation, Suche

checkVersion

Check the current Neutrino LUA-API Version.
If the current version ok, it returns 1, if version too old, an error message will display and returns 0. The script should be canceled (see example).

checkVersion(Parameter) ab API v1.0   -   Neutrino Git


Parameter:

Parameter Typ Description/Beschreibung
1 number major Major Version
2 number minor Minor Version
en: Parameters with default-values are optional. If not needed, no definition is required. In case of missing parameter, default value is used.

de: Parameter mit Default-Wert sind optional. dh. sie müssen nicht angegeben werden. Falls der Parameter fehlt, wird automatisch dieser Wert angenommen.



Return value:

0 version too old, script should be canceled
1 version OK


Example:

 -- Example: Required Neutrino Lua API version = 1.1
 -- if current version too old, will return 0 and script is canceled.
 -- 'do return end' , because of os.exit(0) will terminate the parent program. In case of a regular
 -- LUA script is this the LUA Interpreter, in case of LUA plugin Neutrino itself!

 -- do place this lines on begin of script

local n = neutrino()
local v = n:checkVersion(1, 1)
if (v == 0) then do return end end