diff options
author | elliptic <hyperelliptical@gmail.com> | 2012-05-12 12:52:20 -0400 |
---|---|---|
committer | elliptic <hyperelliptical@gmail.com> | 2012-05-12 12:55:14 -0400 |
commit | ec6e988c33c260ff02ee27bbdacc22b1e282240e (patch) | |
tree | 1d63f2b5eb2026a4c94931315732f44380b09361 /crawl-ref/source/l_moninf.cc | |
parent | 7de84f1062f6064a978d26ff246f1a6cc8a40a8d (diff) | |
download | crawl-ref-ec6e988c33c260ff02ee27bbdacc22b1e282240e.tar.gz crawl-ref-ec6e988c33c260ff02ee27bbdacc22b1e282240e.zip |
Give lua access to monster names.
Rather than having to parse the full m:desc() string each time.
Diffstat (limited to 'crawl-ref/source/l_moninf.cc')
-rw-r--r-- | crawl-ref/source/l_moninf.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crawl-ref/source/l_moninf.cc b/crawl-ref/source/l_moninf.cc index 6e6a63a587..3b85a8c619 100644 --- a/crawl-ref/source/l_moninf.cc +++ b/crawl-ref/source/l_moninf.cc @@ -165,6 +165,14 @@ LUAFN(moninf_get_desc) return (1); } +LUAFN(moninf_get_name) +{ + MONINF(ls, 1, mi); + std::string s = mi->full_name(); + lua_pushstring(ls, s.c_str()); + return (1); +} + static const struct luaL_reg moninf_lib[] = { MIREG(type), @@ -186,6 +194,7 @@ static const struct luaL_reg moninf_lib[] = MIREG(damage_level), MIREG(damage_desc), MIREG(desc), + MIREG(name), { NULL, NULL } }; |