New Addon Author: Help needed - Using Strings

Onigar
Onigar
✭✭✭
Hi, I am new to addon writing and to lua so I guess I am doing something wrong but I just cant see what.

I thought to post my issues here in the hope someone can point me in the right direction. Thanks in advance

I have put all strings in an en.lua file,
local strings = {
	CM_ADDON_LONG_NAME	= "Currency Manager", -- works ok
	CM_ADDON_DESCRIPTION	= "Automatic Management of Character Bankable Currencies",
	CM_MANAGEMENT_TYPE_TIP	= "Select the Management Type",
	CM_GOLD_MANAGEMENT_TYPE	= "|cffff24Gold:|r Management Type",
	CM_PREFIX_GOLD_MAN_TYPE	= "Gold:",
	CM_POSTFIX_GOLD_MAN_TYPE= " Management Type",
	CM_MAN_TYPE_NONE	= "|c5cb700None|r = No Management",
	...
1. this works ok
type = "panel",
	-- name = the title you see in the list of addons when displayed by "Settings, Addons" 
	name = GetString(CM_ADDON_LONG_NAME),
	-- displayName = the title at the top of the addon panel
	displayName = "|c4a9300" .. GetString(CM_ADDON_LONG_NAME) .. "|r",
2. commented line gives no error but does not display
type = "description",
        --text = GetString(CM_MAN_TYPE_NONE), -- does not work but no error
	text = "|c5cb700None|r = No Management",
3. commented lines both give a UI error (second one is what I am aiming for)
type = "dropdown",
	name = "|cffff24Gold:|r Management Type",
	--name = getString(CM_GOLD_MANAGEMENT_TYPE),  -- does not work gives ui error
	--name = "|cffff24" .. getString(CM_PREFIX_GOLD_MAN_TYPE) .. "|r" .. getString(CM_POSTFIX_GOLD_MAN_TYPE),  -- does not work gives ui error
PC EU
Addon Author:
Currency Manager: http://www.esoui.com/downloads/info1998
  • Shinni42
    Shinni42
    ✭✭✭
    Regarding 2), did you register the string first via ZO_CreateStringId("CM_GOLD_MANAGEMENT_TYPE", "|c5cb700None|r = No Management") ?
    For 3), it's GetString not getString.
  • Onigar
    Onigar
    ✭✭✭
    Shinni42 wrote: »
    Regarding 2), did you register the string first via ZO_CreateStringId("CM_GOLD_MANAGEMENT_TYPE", "|c5cb700None|r = No Management") ?
    For 3), it's GetString not getString.

    Thanks for the reply.

    2) yes i did register the string. It seems that sometimes when you make changes /reloadui does not always show the result. After relogging my char I could then see the text with GetString()

    3) How I missed this I don't know but thanks for pointing it out.

    This is fine now and all my strings in the main lua file are replaced by GetString()
    PC EU
    Addon Author:
    Currency Manager: http://www.esoui.com/downloads/info1998
Sign In or Register to comment.