Open Windmolders opened 8 years ago
It is already in place. For instance:
params [["_xb", 1]]; //initialized
params ["_hello"]; //uninitialized
The issue I suppose is finding when the param is set outside the function code, like this scenario:
[123] call {
params ["_myvar"];
};
This gets very complex to detect. I may put in place something to detect it, but the best way of making sure your code is robust is explicitly defining your variables inside the function. (e.g. params [["_var"], 1]
)
if you really want your param be nil by default, you can also set nil explicitly to mute the IDE.
like this: params [["_hello", nil]]; // still nil, but no warning
by the way:
and to make your functions even more robust, you should also whitelist types like this:
params [["_hello", nil, ["", 0]]];
this example allows strings and numbers as first param, while still beeing unitializied by default.
having no bracket there basically means "allow any type here"
There is now a check for nil values.
do you mean youre showing those as warning now as well? :O please don't ... i mean there are cases where i want nil. it was perfect in my opinion.... when i forget to set a default it warns me, and if i say explicit its nil then its fine.
but technically nil means undefined, so actually youre right. damnit
Would it be possible to add variable initialisation recognition for parameters?
example:
_ZCP_RWB_data is marked as an UNinitialized variable