diff options
author | Jude Brown <bookofjude@users.sourceforge.net> | 2010-01-24 21:49:43 +1000 |
---|---|---|
committer | Jude Brown <bookofjude@users.sourceforge.net> | 2010-01-24 22:07:52 +1000 |
commit | d15f7f13d9e7e69c66665b788f95bc2ed30a1e77 (patch) | |
tree | 3adb50433f841e6db6627204903e81c32149663f /crawl-ref/source/l_libs.h | |
parent | 6f65497b7f71cc4ad6c7f8a17f782093824482b3 (diff) | |
download | crawl-ref-d15f7f13d9e7e69c66665b788f95bc2ed30a1e77.tar.gz crawl-ref-d15f7f13d9e7e69c66665b788f95bc2ed30a1e77.zip |
Convert items Lua library to use metatable. May case end-user issues.
Like the monster library, the item library now uses a metatable to store
its functions. Instead of using lightuserdata, as before, and passing
this to the different item.* functions, the functions are now members of
the actual item.
The item library has also been renamed to "items": this allows for its
use in Vault definitions without it clashing with the item specifier and
dgn.item function.
Example:
* Previously, you would use:
local x = item.inventory()[1]
print(item.name(x, false))
* Now, you would use:
local x = items.inventory()[1]
print(x.name(false))
This will have an impact on end-user scripts that use the old version of
the item library. I have already updated the uses of the items library
in the dat/lua scripts, as well as vault definitions and marker
definitions. I think I've caught them all.
There may be bugs or issues, but hopefully that's everything. (Does
cause issues with annotations such as {artefact}, will be fixed
shortly.)
Diffstat (limited to 'crawl-ref/source/l_libs.h')
-rw-r--r-- | crawl-ref/source/l_libs.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/crawl-ref/source/l_libs.h b/crawl-ref/source/l_libs.h index d6008ed2c7..f92594a792 100644 --- a/crawl-ref/source/l_libs.h +++ b/crawl-ref/source/l_libs.h @@ -34,6 +34,7 @@ void cluaopen_globals(lua_State *ls); #define MAPMARK_METATABLE "dgn.mapmark" #define MAPGRD_METATABLE "dgn.mapgrd" #define MAPGRD_COL_METATABLE "dgn.mapgrdcol" +#define ITEM_METATABLE "item.itemaccess" /* * Libraries and loaders for dlua, accessed from init_dungeon_lua(). |