v50 Steam/Premium information for editors
- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.
Lua functions
Jump to navigation
Jump to search
Modding |
---|
Tokens |
Audio · Biome · Graphics · Tile page · Interaction · Mod info · Plant · Speech · Sphere · Syndrome · World |
Body tokens |
Body · Body detail plan · Bodygloss · Tissue |
Creature tokens |
Creature · Creature mannerism · Personality facet · Creature variation · Procedural graphics layer |
Descriptor tokens |
Descriptor color · Color · Descriptor pattern · Descriptor shape |
Entity tokens |
Entity · Ethic · Language · Value · Position |
Job tokens |
Building · Labor · Reaction · Skill · Unit type |
Item tokens |
Item type · Item definition · Ammo · Armor · Instrument · Tool · Trap component · Weapon |
Material tokens |
Material type · Material definition · Inorganic material definition |
Lua |
Scripting · Examples · Functions |
Dwarf Fortress defines a number of functions in addition to those standard for Lua 5.4.
C++ Function Calls
Function | Description |
---|---|
userdata get_random(table t) | Returns a random value from a table. Uses DF's own RNG. |
int trandom(int n) | Returns a 32-bit integer from 1 to n. Uses DF's own RNG. |
str capitalize_string_words(str s) | Capitalizes every word in a string. |
str capitalize_string_first_word(str s) | Capitalizes the first word in a string. |
str utterance() | Returns a word from the kobold language. |
void lua_log(str s) | Prints a string to Dwarf Fortress/lualog.txt . The log() function is more robust and should be used instead.
|