In C# we can
public string sNub
{
set
{
//...
}
get
{
//...
return "nub";
}
}
so when we
sNub = something
then set will get called and a variable will be created inside it 'value' which will be the something.
in get, whatever we return is the value of that variable
Does squirrel has an equivalent?
Thank you.
Squirrel has _set and _get metamod.
Quote from: KAKAN on Nov 17, 2016, 12:16 PMSquirrel has _set and _get metamod.
How to use it?
Quote from: EK.CrystalBlue on Nov 17, 2016, 12:18 PMQuote from: KAKAN on Nov 17, 2016, 12:16 PMSquirrel has _set and _get metamod.
How to use it?
class test{
function _set(idx, val){ print( "Someone is trying to change the value of '" + idx + "' to '" + val + "'"); }
function _get(idx, val){ print( "Someone is trying to get the value of '" + idx); }
}
More info here:- http://www.squirrel-lang.org/squirreldoc/reference/language/metamethods.html