Understanding functions without examples

I coded Ordruun Commando. Nothing difficult by using a trick: each activation increments an ObjectDC register, then when the creature is about to take damage, the damage is reduced by the amount in the register, and the amount in the register is reduced by the amount of damage (of course none of the 2 values goes under zero, I'm checking which one is greater before doing the math). All goes well, but I think that the AI doesn't understand what the ability does: I tested the card against Chandra (perfect for things like this!) and she threw burn spells at the creature even when I had plenties of white mana to spend.
So, I looked at the available functions and saw an interesting one that can be called for an object:
PreventNextDamage
The problem is, we have no examples of that. So how can we understand what parameters are required?
These are the tests I made before writing this topic:
I'm far from being a LUA expert, I know just what I learned by modding DotP. So I ask to those who know better: is there a way to understand the functions for which we don't have any example, without trial and error? Or at least, is there a way to minimize the trial and error?
So, I looked at the available functions and saw an interesting one that can be called for an object:
PreventNextDamage
The problem is, we have no examples of that. So how can we understand what parameters are required?
These are the tests I made before writing this topic:
- Object():PreventNextDamage()
SCRIPT_LOG.TXT says "parameter mismatch or too few parameters [expected bzS32]". - Object():PreventNextDamage(1)
SCRIPT_LOG.TXT says "parameter mismatch or too few parameters [expected bzS32]". - Object():PreventNextDamage(1, 1)
SCRIPT_LOG.TXT says nothing, but the game crashes when I attack with the creature (probably when the AI starts evaluating the card). This would suggest that 2 parameters is the right amount (I think), but one (or both) of them shouldn't be set to 1. - Object():PreventNextDamage(1, Object()), and also Object():PreventNextDamage(Object(), 1)
Again SCRIPT_LOG.TXT says "parameter mismatch or too few parameters [expected bzS32]". So the parameters shouldn't be pointers (I think). But then, why did the game crash with (1, 1)?
I'm far from being a LUA expert, I know just what I learned by modding DotP. So I ask to those who know better: is there a way to understand the functions for which we don't have any example, without trial and error? Or at least, is there a way to minimize the trial and error?