String functions
add_custom_name
function add_custom_name(uid: integer, name: string)uid:integername:string
Adds custom name to the item by uid used in the shops
This is better alternative to add_string but instead of changing the name for entity type, it changes it for this particular entity
add_string
function add_string(str: string): STRINGIDstr:string
Returns STRINGID
Add custom string, currently can only be used for names of shop items (EntityDB->description) Returns STRINGID of the new string
change_string
function change_string(id: STRINGID, str: string)id:STRINGIDstr:string
Change string at the given id (don't use stringid directly for vanilla string, use hash_to_stringid first) This edits custom string and in game strings but changing the language in settings will reset game strings
clear_custom_name
function clear_custom_name(uid: integer)uid:integer
Clears the name set with add_custom_name
enum_get_mask_names
documented onlysource
function enum_get_mask_names(enum: table, value: integer): table<string>enum:tablevalue:integer
Returns table<string>
Return the matching names for a bitmask in an enum table of masks
enum_get_name
documented onlysource
function enum_get_name(enum: table, value: integer): stringenum:tablevalue:integer
Returns string
Return the name of the first matching number in an enum table
enum_get_names
documented onlysource
function enum_get_names(enum: table, value: integer): table<string>enum:tablevalue:integer
Returns table<string>
Return all the names of a number in an enum table
get_character_name
function get_character_name(type_id: ENT_TYPE): stringtype_id:ENT_TYPE
Returns string
Same as Player.get_name
get_character_short_name
function get_character_short_name(type_id: ENT_TYPE): stringtype_id:ENT_TYPE
Returns string
Same as Player.get_short_name
get_string
function get_string(string_id: STRINGID): stringstring_id:STRINGID
Returns string
Get string behind STRINGID, don't use stringid directly for vanilla string, use hash_to_stringid first Will return the string of currently choosen language
hash_to_stringid
function hash_to_stringid(hash: integer): STRINGIDhash:integer
Returns STRINGID
Convert the hash to stringid Check strings00_hashed.str for the hash values, or extract assets with modlunky and check those.
key_name
documented onlysource
function key_name(): stringReturns string
Returns human readable string from KEY chord (e.g. "Ctrl+X", "Unknown" or "None")
set_level_string
-- set the level string shown in hud, journal and game over-- also change the one used in transitions for consistencyset_callback(function() if state.screen_next == SCREEN.LEVEL then local level_str = "test" .. tostring(state.level_count) set_level_string(level_str) change_string(hash_to_stringid(0xda7c0c5b), F"{level_str} COMPLETED!") endend, ON.PRE_LOAD_SCREEN)function set_level_string(str: string)str:string
Set the level number shown in the hud and journal to any string. This is reset to the default "%d-%d" automatically just before PRE_LOAD_SCREEN to a level or main menu, so use in PRE_LOAD_SCREEN, POST_LEVEL_GENERATION or similar for each level. Use "%d-%d" to reset to default manually. Does not affect the "...COMPLETED!" message in transitions or lines in "Dear Journal", you need to edit them separately with change_string.