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

From Dwarf Fortress Wiki
Revision as of 04:00, 25 March 2025 by DPhKraken (talk | contribs) (Added category)
Jump to navigation Jump to search


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.
CancelHideAbout

Rating Lua functions