Gadget File Requirements: Difference between revisions

From SDK
Jump to navigation Jump to search
No edit summary
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 3: Line 3:
'''Gadget File Layout'''
'''Gadget File Layout'''


 
* Line 1 "-- VECTRIC LUA SCRIPT" - Is only required once, placed on the first line of the main gadget Lua file.
''''-- VECTRIC LUA SCRIPT''''
* Line 2 - 16 "Header and Disclaimer" - Is not required but can provide helpful info about the gadget.
is required on the first line of the mail gadget file
* Line 17 "require("mobdebug").start()" - Is commented out in standard run mode and used when debugging in the Zero Brain application.
* Line 18 "require "strict" - Used in standard run mode. Is commented out when in debugging mode.
* Line 19 "local" - When placed out side a function it is seen as a globule variable.
* Line 21. "function" - Used to open a instruction for calling or running by other function.
* Line 24. "return" - sends info back to calling function.
* Line 25. "end" - closes the function.
* Line 27. "-- =====..." - Comment and used to help make code readable
* Line 28. "function main" - Required and is the starting point of the gadget.
* Line 28. "script_path" - Not required. Only used in main function. provides path where the gadget is ran i.e. C:\Vectric10\mygadget...
* Line 35. "local job = VectricJob()" - Sets the VectricJob Info to the job variable.
* Line 36. "if not job.Exists then" - Test if no job send message to the user.
* Line 47. "DisplayTest("Great: The Gadget Seed is working" .. " Version: " .. Ver )" - Runs sub-function to display version info.
* Line 48. "return" - sends true to Vectric gadget is complete.
* Line 49. "end" - closes the main function.


=====For Example:=====
=====For Example:=====
<nowiki>  -- VECTRIC LUA SCRIPT
  1. -- VECTRIC LUA SCRIPT
-- ===================================================]]
  2. -- ===================================================]]
-- Gadgets are an entirely optional add-in to Vectric's core software products.  
  3. -- Gadgets are an entirely optional add-in to Vectric's core software products.  
-- They are provided 'as-is', without any express or implied warranty, and you make use of them entirely at your own risk.
  4. -- They are provided 'as-is', without any express or implied warranty, and you make use of them entirely at your own risk.
-- In no event will the author(s) or Vectric Ltd. be held liable for any damages arising from their use.
  5. -- In no event will the author(s) or Vectric Ltd. be held liable for any damages arising from their use.
 
  6.
-- Permission is granted to anyone to use this software for any purpose,  
  7. -- Permission is granted to anyone to use this software for any purpose,  
-- including commercial applications, and to alter it and redistribute it freely,  
  8. -- including commercial applications, and to alter it and redistribute it freely,  
-- subject to the following restrictions:
  9. -- subject to the following restrictions:
-- 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.  
10. -- 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.  
-- 2. If you use this software in a product, an acknowledgement in the product documentation would be appreciated but is not required.
11. -- 2. If you use this software in a product, an acknowledgement in the product documentation would be appreciated but is not required.
-- 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
12. -- 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
-- 4. This notice may not be removed or altered from any source distribution.
13. -- 4. This notice may not be removed or altered from any source distribution.
 
14. -- Easy Seed Gadget Master is written by Jim Anderson of Houston Texas 2020
-- Easy Seed Gadget Master is written by Jim Anderson of Houston Texas 2020
15. -- ===================================================]]
-- ===================================================]]
16. -- Global Variables --
-- Global Variables --
17. -- require("mobdebug").start()
-- require("mobdebug").start()
18. require "strict"
local Ver = "6.0"  -- Version 6: Jan 2020 - Clean Up and added Ver to Dialog   
19. local Ver = "6.0"  -- Version 6: Jan 2020 - Clean Up and added Ver to Dialog   
-- ===================================================]]
20. -- ===================================================]]
function DisplayTest(words)
21. function DisplayTest(words)
  -- test a sub fuction
22. -- test a sub fuction
    DisplayMessageBox(words)
23.  DisplayMessageBox(words)
return true
24.  return true
end -- function end
25. end -- function end
 
26.
-- ===================================================]]
27. -- ===================================================]]
function main(script_path)
28. function main(script_path)
--[[
29. --[[
Gadget Notes: Dec 2019 - My New Gadget
30.  Gadget Notes: Dec 2019 - My New Gadget
 
31.   ]]
   ]]
32. -- Localized Variables --
-- Localized Variables --
33.
 
34. -- Job Validation --
-- Job Validation --
35.  local job = VectricJob()
  local job = VectricJob()
36.  if not job.Exists then
  if not job.Exists then
37.    DisplayMessageBox("Error: No job loaded")
    DisplayMessageBox("Error: No job loaded")
38.    return false ;  
    return false ;  
40.  end
  end
41.
 
42. -- Get Data --
-- Get Data --
43.
 
44. -- Calculation --
-- Calculation --
45.
 
46. -- Do Something --
-- Do Something --
47. DisplayTest("Great: The Gadget Seed is working" .. " Version: " .. Ver )
 
48. return true
  DisplayTest("Great: The Gadget Seed is working" .. " Version: " .. Ver )
49. end  -- function end
 
50. -- ===================================================]]
  return true
 
end  -- function end
-- ===================================================]] </nowiki>

Latest revision as of 08:58, 21 May 2023

Back.jpg

Gadget File Layout

  • Line 1 "-- VECTRIC LUA SCRIPT" - Is only required once, placed on the first line of the main gadget Lua file.
  • Line 2 - 16 "Header and Disclaimer" - Is not required but can provide helpful info about the gadget.
  • Line 17 "require("mobdebug").start()" - Is commented out in standard run mode and used when debugging in the Zero Brain application.
  • Line 18 "require "strict" - Used in standard run mode. Is commented out when in debugging mode.
  • Line 19 "local" - When placed out side a function it is seen as a globule variable.
  • Line 21. "function" - Used to open a instruction for calling or running by other function.
  • Line 24. "return" - sends info back to calling function.
  • Line 25. "end" - closes the function.
  • Line 27. "-- =====..." - Comment and used to help make code readable
  • Line 28. "function main" - Required and is the starting point of the gadget.
  • Line 28. "script_path" - Not required. Only used in main function. provides path where the gadget is ran i.e. C:\Vectric10\mygadget...
  • Line 35. "local job = VectricJob()" - Sets the VectricJob Info to the job variable.
  • Line 36. "if not job.Exists then" - Test if no job send message to the user.
  • Line 47. "DisplayTest("Great: The Gadget Seed is working" .. " Version: " .. Ver )" - Runs sub-function to display version info.
  • Line 48. "return" - sends true to Vectric gadget is complete.
  • Line 49. "end" - closes the main function.
For Example:
 1. -- VECTRIC LUA SCRIPT
 2. -- ===================================================]]
 3. -- Gadgets are an entirely optional add-in to Vectric's core software products. 
 4. -- They are provided 'as-is', without any express or implied warranty, and you make use of them entirely at your own risk.
 5. -- In no event will the author(s) or Vectric Ltd. be held liable for any damages arising from their use.
 6. 
 7. -- Permission is granted to anyone to use this software for any purpose, 
 8. -- including commercial applications, and to alter it and redistribute it freely, 
 9. -- subject to the following restrictions:
10. -- 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. 
11. -- 2. If you use this software in a product, an acknowledgement in the product documentation would be appreciated but is not required.
12. -- 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13. -- 4. This notice may not be removed or altered from any source distribution.
14. -- Easy Seed Gadget Master is written by Jim Anderson of Houston Texas 2020
15. -- ===================================================]]
16. -- Global Variables --
17. -- require("mobdebug").start()
18. require "strict"
19. local Ver = "6.0"  -- Version 6: Jan 2020 - Clean Up and added Ver to Dialog  
20. -- ===================================================]]
21. function DisplayTest(words)
22. -- test a sub fuction
23.   DisplayMessageBox(words)
24.   return true
25. end -- function end
26. 
27. -- ===================================================]]
28. function main(script_path)
29. --[[
30.  Gadget Notes: Dec 2019 - My New Gadget
31.   ]]
32. -- Localized Variables --
33. 
34. -- Job Validation --
35.  local job = VectricJob()
36.  if not job.Exists then
37.    DisplayMessageBox("Error: No job loaded")
38.    return false ; 
40.  end
41.
42. -- Get Data --
43.
44. -- Calculation --
45.
46. -- Do Something --
47. DisplayTest("Great: The Gadget Seed is working" .. " Version: " .. Ver )
48. return true
49. end  -- function end
50. -- ===================================================]]