Download
(15 Kb)
Download
Updated: 05/12/19 05:36 PM
Compatibility:
Elsweyr (5.0.5)
Wrathstone (4.3)
Updated:05/12/19 05:36 PM
Created:05/12/19 05:36 PM
Monthly downloads:1,793
Total downloads:105,407
Favorites:5
MD5:
LibManifest  Popular! (More than 5000 hits)
Version: 1.0.0
by: Drakanwulf, hawkeye1889
LibManifest builds a table of manifest directive values for the "addOnName" you specify.

What It Is:
LibManifest is a standalone support add-on that builds a table of manifest directive values from data returned by the game's "AddOnManager" and other API functions.

"Standalone" means that LibManifest should not be embedded. Please load only one instance of LibManifest from the ".../Addons/" directory and use a "##DependsOn: LibManifest" directive in the manifest file for your add-on to instruct the game to verify that LibManifest is running before the game loads your add-on.

WARNING: You must be running ESO game code for the Elsweyr API (100027), or greater, for this support add-on to function correctly. While it will work with WrathStone (100026), its Elsweyr values will be invalid until 100027 is released.

What It Does:
  • LibManifest contains bootstrapping code to load itself only one time.
  • LibManifest creates a new global control entry whenever it has not been loaded before.
  • LibManifest fails all duplicate start up attempts that occur after its initial start up.
  • LibManifest creates a"test" table of its own directive values to verify that it is functioning correctly.
API Functions:
LibManifest has but one API function.

LibManifest:Create
If a global control entry for "addOnName" exists (e.g. _G["addonName"]), Create returns a pointer to the table it created and the index value to where it found the entry for your named add-on. Otherwise, if the global control entries list for your character does not have an entry for the named add-on (i.e. "addOnName"), Create returns a nil pointer and an invalid index value (e.g. zero) to indicate that a control entry for "addOnName" could not be found. Please use this link to refer to the LibManifest documentation wiki to get all the information about LibManifest, its API function and its input parameter and return values.

Note: The "addOnName: string" syntax tells the Havok VM to fail the API call if "addOnName" does not contain a .lua alphanumeric string.

Lua Code:
  1. function LibManifest:Create( addOnName: string )
  2.     return Create( addOnName ) or nil, 0
  3. end

Table Layout:
This code illustrates a manifest table layout. You will need to make a copy of this table code if your add-on makes reference to any of the table's fields. The comment fields are informational asides and opinions.

Lua Code:
  1. manifest = {
  2.     -- These values are retrieved from existing manifest directives
  3.     author,     -- From the Author: directive Without any special characters
  4.     description,    -- From the Description: directive
  5.     fileName,       -- The name of this add-on's folder and manifest file
  6.     isEnabled,      -- ESO boolean value
  7.     isOutOfDate,    -- ESO boolean value
  8.     loadState,      -- ESO load state (i.e. loaded; not loaded)
  9.     title,          -- From the Title: directive without any special characters
  10.  
  11.     -- These values are retrieved from 100026 manifest directives
  12.     addOnVersion,   -- From the AddOnVersion: directive
  13.     filePath,       -- Path to this add-on's folder/directory
  14.  
  15.     -- These values are retrieved from 100027 manifest directives
  16.     isLibrary,      -- From the IsLibrary: directive
  17. }

Examples:
This code illustrates how LibManifest processes valid start up attempts and fails all duplicate start up
attempts because trapping them is one way to determine who was doing what and when, which should
give us the why.
Lua Code:
  1. --[[-------------------------------------------------------------------------------------------------------------------
  2. Local variables shared by multiple functions within this add-on.
  3. ---------------------------------------------------------------------------------------------------------------------]]
  4. local ADDON_NAME = "LibManifest"
  5. local addon = {}
  6.  
  7. --[[-------------------------------------------------------------------------------------------------------------------
  8. Bootstrap code to either load or fail this add-on.
  9. ---------------------------------------------------------------------------------------------------------------------]]
  10. assert( not _G[ADDON_NAME], ADDON_NAME.. ": is already loaded. Do NOT load add-ons multiple times!" )
  11.  
  12. _G[ADDON_NAME] = addon
  13. assert( _G[ADDON_NAME], ADDON_NAME.. ". The game failed to create a global control entry!" )
  14.  
  15. --[[-------------------------------------------------------------------------------------------------------------------
  16. ... And add-on initialization continues on from here...
  17. ---------------------------------------------------------------------------------------------------------------------]]

This code illustrates how LibManifest tests and verifies that its API is working properly. "/tbug LibManifest" commands will show you a "table" entry whose tabbed fields, in turn, will show you the contents of the LibManifest.txt manifest file the game used to load the add-on.
Lua Code:
  1. --[[-------------------------------------------------------------------------------------------------------------------
  2. And the last thing we do in this add-on is to wait for ESO to notify us that our modules and support
  3. add-ons (i.e. libraries) have been loaded so we can retrieve our own manifest table to verify that this
  4. add-on is functioning correctly.
  5. ---------------------------------------------------------------------------------------------------------------------]]
  6. local function OnAddonLoaded( event, name )
  7.     if name ~= ADDON_NAME then
  8.         return
  9.     end
  10.     EVENT_MANAGER:UnregisterForEvent( ADDON_NAME, EVENT_ADD_ON_LOADED )
  11.  
  12.     local test, index = Create( ADDON_NAME )
  13.     assert( test ~= nil, ADDON_NAME.. ": Failed! The table return value was nil" )
  14.     assert( index > 0, ADDON_NAME.. ": Failed! The index return value was zero" )
  15.    
  16.     addon.manifest = test
  17.     _G[ADDON_NAME] = addon
  18. end
  19.  
  20. EVENT_MANAGER:RegisterForEvent( ADDON_NAME, EVENT_ADD_ON_LOADED, OnAddonLoaded )
There have been no comments posted to this file.
Be the first to add one.



Category Jump: