(07-29-2013, 04:24 PM)hunchbackproduction Wrote: Alright, just came back from holidays and ready to code ![Big Grin Big Grin](https://www.frictionalgames.com/forum/images/smilies/biggrin.gif)
I ain't no pro haxor, so could you please explain to me wtf is a parameter and actually give me a example of the SetLanternLitCallback being used please xD.
Sorry for the hassle and thanks for the help so far dudes!
Welcome back!
A parameter is a value passed to a function. In the most basic sense.
//For example
public void addNumber(int i, int k)
{
//Prints the sum of two numbers
print(i + k);
}
In this snippet, "i" and "k" represent integers. Their values are "passed" (think, "sent to") the function addNumber.
Say you wanted to use the function somewhere. You would write:
In this case, the parameter "i" represents the integer value of 3. Whereas "k" represents 1.
Now, for the lantern callback, it's pretty much the same. Only what's passed is a "boolean" (true/false) type.
public void test(bool lanternLit)
{
if(lanternLit) //Shorthand for if *** is "true"
{
//Code to keep the monsters away
}
else //If the lanterLit value is "false"
{
//Code to get attacked by monsters
}
}
Only in this case, the parameter is passed internally.