Strings (functions)

From PMDOWiki
More functions: Script Reference

This page documents the ScriptStrings class for Lua scripting.

As a singleton class, it can be accessed from Lua with STRINGS.

MakePackageStringTable

STRINGS:MakePackageStringTable(packagefilepath)

DEPRECATED

Parameters

Name Type Description
System.String System.String

Returns

Type Description
NLua.LuaTable


LoadPackageStringTable

STRINGS:LoadPackageStringTable(packagefilepath)

Loads the string table of the current map to MapStrings.
Do not call this function from lua.
It is called automatically on map load.

Parameters

Name Type Description
System.String System.String


LocaleCode

STRINGS:LocaleCode()

Gets the current language setting of the game.


Returns

Type Description
System.String The current language, represented by a locale code.


ShiftString

STRINGS:ShiftString(baseStr, shift)

Takes all letters of a string and shifts their unicode values forward by a specified amount.
Useful for special character sets.

Parameters

Name Type Description
System.String System.String The string to have its letter shifted forward.
System.Int32 System.Int32 The amount to shift the letters forward.

Returns

Type Description
System.String The shifted string.


Format

STRINGS:Format(fmt, args)

Formats a string. Will unescape escaped characters and process grammar tags.

Parameters

Name Type Description
System.String System.String The string to format.
System.Object[] System.Object[] Additional arguments to pass into the string being formatted.

Returns

Type Description
System.String The formatted string.


FormatKey

STRINGS:FormatKey(fmt, args)

Takes the string key, looks up the string it represents, and formats it. Will unescape escaped characters and process grammar tags.

Parameters

Name Type Description
System.String System.String The string key to look up and use for formatting.
System.Object[] System.Object[] Additional arguments to pass into the string being formatted.

Returns

Type Description
System.String The formatted string.


LocalKeyString

STRINGS:LocalKeyString(index)

Gets the string representing a button or key.

Parameters

Name Type Description
System.Int32 System.Int32 The input type of the input.

Returns

Type Description
System.String The string representing the button o key the input maps to.


CreateList

STRINGS:CreateList(listStrings)

Builds a single string of comma separated elements.

Parameters

Name Type Description
NLua.LuaTable NLua.LuaTable LuaTable of strings containing the elements to build the list from.

Returns

Type Description
System.String The combined string containing all elements.


SetupLuaFunctions

STRINGS:SetupLuaFunctions(state)

Initializes any LuaFunctions found in the class.
Automatically on lua initialization.

Parameters

Name Type Description
RogueEssence.Script.LuaEngine RogueEssence.Script.LuaEngine The lua engine to initialize with.


References

https://github.com/RogueCollab/RogueEssence/blob/master/RogueEssence/Lua/ScriptStrings.cs