User Tools

Site Tools



acr

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
acr [2016/04/15 15:30] aceacr [2021/06/22 16:26] ace
Line 117: Line 117:
 -- Return the profile to ACR, so it can be read. -- Return the profile to ACR, so it can be read.
 return profile return profile
 +
 +</code>
 +
 +==== Pushing Routines API ====
 +
 +<code lua>
 +
 +-- This code is an example of how to push routines into ACR using the new API call.
 +
 +acelib.routinePath = GetStartupPath()..[[\LuaMods\AceLib\CombatRoutines\]] --this can be any subfolder, I'm using the old structure for ease
 +
 +function AceLib.LoadCombatProfile(filename,alias)
 + if (acelib.ModuleFunctions and acelib.ModuleFunctions.ReadModuleFile) then
 + local fileInfo = { p = "CombatRoutines" , m = "AceLib" , f = filename }
 + local fileString = acelib.ModuleFunctions.ReadModuleFile(fileInfo)
 + if (fileString) then
 + local fileFunction, errorMessage = loadstring(fileString)
 + if (fileFunction) then
 + local ok, profileData = pcall(fileFunction)
 + if (ok and profileData ~= nil) then
 + ACR.AddPrivateProfile(profileData,alias)
 + end
 + end
 + end
 + else
 + if (filename ~= "" and FileExists(acelib.routinePath..filename)) then
 + local profileData,e = persistence.load(acelib.routinePath..filename)
 + if (ValidTable(profileData)) then
 + ACR.AddPrivateProfile(profileData,alias)
 + end
 + end
 + end
 +end
 +
 +function AceLib.LoadCombatProfiles()
 + AceLib.LoadCombatProfile("Ark.lua","Ark")
 +end
 +
 +-- Final call should be done in a ModuleInit so that all modules can finish loading other API where required.
 +function acelib.ModuleInit()
 +        AceLib.LoadCombatProfiles()
 +end
  
 </code> </code>
acr.txt · Last modified: 2022/08/25 08:06 by anyone