title: Lua Scripting Error for Dota 2
body: <p>No where else seems to be able to help me so I came here in the hopes that someone can help with with this problem I am having with Lua scripting for Dota2</p>
  
  <p>Here is my broken code:</p>
  
  <pre><code>function ApplyDamage(keys)
  
  local caster = keys.caster
  local ability = keys.ability
  local target = keys.target
  
  ability.level = ability:GetLevel() - 1
  
  local ability_dmg = ability:GetLevelSpecialValueFor( "damage", ability.level )
  
  if caster:HasScepter() then
      ability_dmg = ability:GetSpecialValueFor( "damage_scepter", ability.level )
  end
  
  ApplyDamage({victim = target, attacker = caster, damage = ability_dmg, damage_type = ability:GetAbilityDamageType()})   
  </code></pre>
  
  <p>end</p>
  
  <p>This is returning the error:</p>
  
  <p><a href="https://i.stack.imgur.com/KDtrg.png" rel="nofollow noreferrer">https://i.stack.imgur.com/KDtrg.png</a></p>
  
  <p>I can't figure out why it is doing this or how I can fix this. Please help.</p>