Global Methods: Difference between revisions

From SDK
Jump to navigation Jump to search
Line 55: Line 55:
     |  ThisAppInfo() Collects information about the application and  
     |  ThisAppInfo() Collects information about the application and  
     |  provides the user with the following:
     |  provides the user with the following:
     |    Application name  
     |    Application name.
     |    If the version is a Beta
     |    Version is a Beta/Pro.
     |    The version number.
     |    The version number.
     |    The build number.
     |    The build number.
     -------------------------------------------------------------]]
     -------------------------------------------------------------]]
     function ThisAppInfo()
     function ThisAppInfo()
       local ThisApp = ""
       local ThisApp = "" -- Sets ThisApp as a string
       local AppVersion  = tostring(GetAppVersion())
       local AppVersion  = tostring(GetAppVersion())   -- Gets the App Version
       local BuildVersion = tostring(GetBuildVersion())
       local BuildVersion = tostring(GetBuildVersion()) -- Gets the Build Version
     
 
       if IsAspire() then
       if IsAspire() then -- Set the Re
         ThisApp = "Application: Aspire"
         ThisApp = "Application: Aspire"
       else
       else
         ThisApp = "Application: VCarve Pro"
         ThisApp = "Application: VCarve Pro or Cut2D Pro  "
       end -- if end
       end -- if end


Line 80: Line 80:
                           "\nCompile No: " .. BuildVersion
                           "\nCompile No: " .. BuildVersion


       MessageBox("Current application informaction: \n" .. ThisApp)
       MessageBox("Current Application Information\n" .. ThisApp)
     end -- function end
     end -- function end
   -- ===========================================================]]
   -- ===========================================================]]
Line 87: Line 87:
       return true
       return true
     end -- function end </nowiki>
     end -- function end </nowiki>
[[File:VCarve Pro4.png|left|290px]]
[[File:VCarve Pro5.png|left|290px]]





Revision as of 10:47, 2 June 2024

Back.jpg

Most of the actions you can perform from Lua are done by calling methods on objects associated with the current job. There are a few methods which operate Globally on the application and they are documented here.

IsAspire()


Returns true if the script is running inside Aspire.

IsBetaBuild()


Returns true if this is a Beta build rather than a release build

GetAppVersion()


Returns application version number as a double (e.g 4.004 for Aspire V4.0)

GetBuildVersion()


Returns application internal build version which is the same for both Aspire and VCarve Pro. This is different to the AppVersion above as Aspire 4.004 will report e.g. 7.004 which matches VCarve Pro 7.004 as they are built off the same code base, and have the same script level support.

MessageBox( string text)


Displays a message box with passed text to user. The text can include HTML formatting. text – string – text to display in the message box.

Usage Syntax:

Example Code:
-- VECTRIC LUA SCRIPT
-- require("mobdebug").start()
require "strict"

function main()
  MessageBox("Hello World!!!")
  return true
end -- Function
HelloWorld2.png







Example Code:

This code displays all of the application internal build information. See MessageBox image below

  -- VECTRIC LUA SCRIPT
  -- require("mobdebug").start()
  require "strict"
  --[[------------------------------------------------------------- 
    |  ThisAppInfo() Collects information about the application and 
    |  provides the user with the following:
    |    Application name. 
    |    Version is a Beta/Pro.
    |    The version number.
    |    The build number.
    -------------------------------------------------------------]]
    function ThisAppInfo()
      local ThisApp = ""  -- Sets ThisApp as a string
      local AppVersion   = tostring(GetAppVersion())   -- Gets the App Version
      local BuildVersion = tostring(GetBuildVersion()) -- Gets the Build Version

      if IsAspire() then -- Set the Re
        ThisApp = "Application: Aspire"
      else
        ThisApp = "Application: VCarve Pro or Cut2D Pro   "
      end -- if end

      if IsBetaBuild() then
        ThisApp = ThisApp .."\nRelease: Is for Beta Testing"
      else
        ThisApp = ThisApp .."\nRelease: Is for Production"
      end -- if end

      ThisApp = ThisApp .. "\nVersion No: " .. AppVersion ..
                           "\nCompile No: " .. BuildVersion

      MessageBox("Current Application Information\n" .. ThisApp)
    end -- function end
  -- ===========================================================]]
    function main() 
       ThisAppInfo()
       return true
    end -- function end 
VCarve Pro5.png









Back.jpg

References

Please Note: The base material for the contents found in this WiKi was sourced from Vectric Lua Interface for Gadgets, version 10.0, published August 21 2019. by Vectric Ltd. Most current document from Vertric can be downloaded at Vertric Developer Information