diff options
| author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-05-04 09:49:30 +0200 |
|---|---|---|
| committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-05-11 23:31:15 +0200 |
| commit | 7e88a973c00bd96af1288399a4e6dab207e8683c (patch) | |
| tree | 3e14ffe7187ab0db6338787198c0455aec1e5e0a /src/scripting | |
| parent | f6765ffda1e0db5006aaebc359b2634837fe70bd (diff) | |
| download | manaserv-7e88a973c00bd96af1288399a4e6dab207e8683c.tar.gz manaserv-7e88a973c00bd96af1288399a4e6dab207e8683c.tar.xz manaserv-7e88a973c00bd96af1288399a4e6dab207e8683c.zip | |
Added get_monster_classes() bind
It returns all monster classes in a id->monsterclass table.
Diffstat (limited to 'src/scripting')
| -rw-r--r-- | src/scripting/lua.cpp | 14 | ||||
| -rw-r--r-- | src/scripting/luautil.h | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index b3fe93c..9ffe1f2 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -2955,6 +2955,19 @@ static int get_monster_class(lua_State *s) return 1; } +/** LUA get_monster_classes (monsterclass) + * get_monster_classes() + ** + * **Return value:** A Table with all monster classes. The id of the monster + * is the key. The monster class itself the value. See below for the usage of + * this object. + */ +static int get_monster_classes(lua_State *s) +{ + pushSTLContainer(s, monsterManager->getMonsterClasses()); + return 1; +} + /** LUA monsterclass:on_update (monsterclass) * monsterclass:on_update(function callback) ** @@ -3260,6 +3273,7 @@ LuaScript::LuaScript(): { "on_mapupdate", on_mapupdate }, { "get_item_class", get_item_class }, { "get_monster_class", get_monster_class }, + { "get_monster_classes", get_monster_classes }, { "get_status_effect", get_status_effect }, { "npc_create", npc_create }, { "say", say }, diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h index e7cbc75..653bf24 100644 --- a/src/scripting/luautil.h +++ b/src/scripting/luautil.h @@ -212,6 +212,11 @@ inline void push(lua_State *s, MapObject *val) LuaMapObject::push(s, val); } +inline void push(lua_State *s, MonsterClass *val) +{ + LuaMonsterClass::push(s, val); +} + /* Pushes an STL LIST */ template <typename T> |
