Lua fragment syntax sketchily.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1923 c06c8d41-db1a-0410-9941-cceddc491573
TTGCXNOSKYDDDJYGJV2RKHKJTWZROB7RNOZCXIO2TVXVYIDNIAWQC
XYJ5Y635KCRCTL2BFPP53NWQRK3NUHS6T3ARPIXV5A3CHWBW7VCQC
K2CS6TCX2NDVL2ASEHGP4J4K4IJ6FP3ANNKTSIWVG43HPYSBX6ZQC
SDLKLUNFGVKDS55DDJZCBAVIB7NL3RRYPTACAY65SCUQKV6APFSAC
UPJVSMMMHGRDUIJG4MZX6IBLQ4ODBF5Z3PF3RHDYTSAEOCVDZM5AC
EHSY6DVGUMI6C67WKET3GDJVLWJWGYBYQONNDK5JVT7BCTHBEZVAC
RVST2QHYJ757ZHK4AUJ5NGPDZ44AD6RVFVXYPKQIBJXZBDNUCHXQC
XPCGZBHHSL6MB3ORMUJI64BAERU6AZTIY6RK56BBW7SNB3IK24IAC
if (!inscriptcond && str[0] == ':')
{
// The init file is now forced into isconditional mode.
isconditional = true;
str = str.substr(1);
if (!str.empty() && runscript)
{
// If we're in the middle of an option block, close it.
if (luacond.length() && l_init)
{
luacond += "]] )\n";
l_init = false;
}
luacond += str + "\n";
}
continue;
}
Lua files are scripts which can provide existing commands with a new meaning
or even create new commands (to be used in macros). If you don't know a
specific reason not to include some or all lua files, you'll do best to just
include them all.
Lua files are scripts which can provide existing commands with a new
meaning or create new commands (to be used in macros). To use Lua
files, Crawl needs to be compiled with support for user Lua scripts.
You can if your Crawl has Lua support by hitting V in-game. The list
of features Crawl displays should include "Lua user scripts".
Lua files are included using the lua_file option (one file per line):
7- Inline Lua
------------------
Lua code can be used directly in your init.txt/.crawlrc. You can use
Lua to selectively include parts of your init.txt (based on character
type, for instance) using this syntax:
< Lua code >
or
<
Lua code
>
or
: Lua code till end of line
Examples:
# Print a welcome message
: crawl.mpr("Hello " .. you.name())
<
# Another welcome message
crawl.mpr("Hi there")
>
# Controlling visibility of options:
: if you.race() == "Mummy" then
autopickup = $?+"/
: else
autopickup = $?+"/!%
: end