ConvertUnitStringField
- Parameters
i integer- comment
- note
Many fields don't work at all with
BlzGetUnitStringFieldorBlzSetUnitStringField.- Icon - Game Interface
uicodoesn't - Icon - Score Screen
ussidoesn't - Art - Model File
umdldoesn't - Art - Special
uspadoesn't - Combat - Attack 1 - Projectile Art
ua1mdoesn't - Text - Name
UNIT_SF_NAMEaka 'unam' works - Text - Proper Names
UNIT_SF_PROPER_NAMESaka 'upro' works - Tooltip Awaken
uawtdoesn't - Tooltip Extended
utubdoesn't - Tooltip Revive
utprdoesn't
Test code (Lua, 2.0.2):
-- Create unit, try different string fields on it. -- Output format: rawcode,stringLength, setResult=boolean,string h5 = CreateUnit(Player(0), FourCC("Hamg"), -30, 0, 90) t = {"uico", "ussi", "umdl", "uspa", "ua1m", "unam", "upro", "uawt", "utip", "utub", "utpr"} for k,rawcode in pairs(t) do local sf = ConvertUnitStringField(FourCC(rawcode)) local getPre = BlzGetUnitStringField(h5, sf) local setText = "set-" .. rawcode local setResult = BlzSetUnitStringField(h5, sf, setText) local getPost = BlzGetUnitStringField(h5, sf) local fmt = "\x25s=\x25d; setResult=\x25s,\x25s" print(fmt:format(rawcode, #getPre, tostring(setResult), getPost)) end- Icon - Game Interface
- pure
- This function is pure. For the same values passed to it, it will always return the same value.
- patch
1.31.0.11889
- Source
- common.j (suggest an edit or discuss on Github)
- return type
unitstringfield- Source code
constant native ConvertUnitStringField takes integer i returns unitstringfield