View Single Post
02/02/22, 01:41 PM   #1
Gullyable
Join Date: Apr 2018
Posts: 13
Python to generate esoui_constants_live.lua

Howdy,

I'm playing around with the automatic generation of a file with functions that will take constant values and return the appropriate text, such as CurrencyType_get_string(0) returns "CURT_ALLIACANCE_POINTS". It's not elegant - I basically took a hammer to it. I'm having trouble using the output file atm, tho.

Is there a fixed url to find the live docs?

Is there a limit on .lua file sizes? Currently I'm limiting the output to just the mappings that I need and if I let it generate them all the file is around 1MB.

[edit]
Code is now here: https://github.com/marcjordan2112/get_esoui_api_data

The current output follows. I save this to a file called esoui_constants_live.lua in my egr addon directory. What's the proper way to include the file and use the functions?

Code:
local ACTIONBARSLOTTYPE_STRINGS = {
    [1] = "ACTION_TYPE_ABILITY",
    [6] = "ACTION_TYPE_CHAMPION_SKILL",
    [7] = "ACTION_TYPE_COLLECTIBLE",
    [8] = "ACTION_TYPE_EMOTE",
    [2] = "ACTION_TYPE_ITEM",
    [0] = "ACTION_TYPE_NOTHING",
    [10] = "ACTION_TYPE_QUEST_ITEM",
    [9] = "ACTION_TYPE_QUICK_CHAT",
}
function ActionBarSlotType_get_string(value)
    return ACTIONBARSLOTTYPE_STRINGS[value] or tostring(value)
}

Last edited by Gullyable : 02/03/22 at 06:56 PM.
  Reply With Quote