comparison Main.lua @ 227:3dd05b29bc6f 1.0.38

Make sure the NPC entry is non-nil before attempting to set its metatable.
author James D. Callahan III <jcallahan@curse.com>
date Tue, 29 Jan 2013 17:45:24 -0600
parents 86b3d5b00a90
children 25bfbe8b4826
comparison
equal deleted inserted replaced
226:7471bca69c99 227:3dd05b29bc6f
331 local npc_meta = { 331 local npc_meta = {
332 __index = npc_prototype 332 __index = npc_prototype
333 } 333 }
334 334
335 function NPCEntry(identifier) 335 function NPCEntry(identifier)
336 local npc = _G.setmetatable(DBEntry("npcs", identifier), npc_meta) 336 local npc = DBEntry("npcs", identifier)
337 337
338 if not npc then 338 if not npc then
339 return 339 return
340 end 340 end
341 return npc 341 return _G.setmetatable(npc, npc_meta)
342 end 342 end
343 343
344 function npc_prototype:EncounterData() 344 function npc_prototype:EncounterData()
345 local instance_token = InstanceDifficultyToken() 345 local instance_token = InstanceDifficultyToken()
346 self.encounter_data = self.encounter_data or {} 346 self.encounter_data = self.encounter_data or {}