ScriptInterface:AppVersion()

Version added: 9.5

Return value:

char
Examples of how to get the version as a decimal number (can be useful if the version is something like "10.1.1", which cannot be converted to a number using "tonumber").

ex1 - strip off the second and any later point versions:
if moho.AppVersion ~= nil then
  local sVersion = string.gsub(moho:AppVersion(), "^(%d+)(%.%d+)(%..+)", "%1%2")
  version = tonumber(sVersion) 
end



ex2 - builds a decimal number assuming point versions will not be greater than 9 (i.e. nn.9.9.9.9)
local order = 1
local numVers = 0
local n
local vers = moho:AppVersion() -- assumes AS9.5 or later
for n in string.gmatch (vers, "%d+%.*") do
	numVers = numVers + (n * order)
	order = order / 10
end
print (numVers)
<< Back to ScriptInterface