From 8b8742b242f55a314f041c4e291ca95df33116bb Mon Sep 17 00:00:00 2001 From: KimLS Date: Wed, 3 Jul 2013 15:20:42 -0700 Subject: [PATCH] Fix for Spell(int) not working in lua... --- zone/lua_spell.cpp | 10 +++++++++- zone/lua_spell.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/zone/lua_spell.cpp b/zone/lua_spell.cpp index 84fd6311c..597982770 100644 --- a/zone/lua_spell.cpp +++ b/zone/lua_spell.cpp @@ -6,6 +6,14 @@ #include "../common/spdat.h" #include "lua_spell.h" +Lua_Spell::Lua_Spell(int id) { + if(IsValidSpell(id)) { + SetLuaPtrData(&spells[id]); + } else { + SetLuaPtrData(nullptr); + } +} + int Lua_Spell::GetID() { Lua_Safe_Call_Int(); return self->id; @@ -416,10 +424,10 @@ int Lua_Spell::GetDamageShieldType() { return self->DamageShieldType; } - luabind::scope lua_register_spell() { return luabind::class_("Spell") .def(luabind::constructor<>()) + .def(luabind::constructor()) .property("null", &Lua_Spell::Null) .property("valid", &Lua_Spell::Valid) .def("ID", &Lua_Spell::GetID) diff --git a/zone/lua_spell.h b/zone/lua_spell.h index ba1307754..9a8435cc5 100644 --- a/zone/lua_spell.h +++ b/zone/lua_spell.h @@ -16,6 +16,7 @@ class Lua_Spell : public Lua_Ptr { typedef const SPDat_Spell_Struct NativeType; public: + Lua_Spell(int id); Lua_Spell() : Lua_Ptr(nullptr) { } Lua_Spell(const SPDat_Spell_Struct *d) : Lua_Ptr(d) { } virtual ~Lua_Spell() { }