I think that this is a problem of Lua not clearly handling list of return values, but it could be even worse and seen as a security issue.
Say you have defined: function func(userid, publicdata, privatedata).
And you call: func(userid, getpublicdata(userid), getprivatedata(userid))
There is NO warranty at all that fun() will process publicdata containing ONLY the return value(s) of getpublicdata().
It could happen that publicdata used by fun() will return what was returned by getprivatedata(), and that privatedata would be nil in that case.
This would happen if getpublicdata() for example checks if userid is declared visible in some database, and if not (concealed user), it would return nothing (assuming it is equivalent to returning nil). But that userid would still have privatedata, that would suddenly be made accessible inside fun() as if it was public.
So instead of calling:
func(userid, getpublicdata(userid), getprivatedata(userid))
You need to call:
func(userid, (getpublicdata(userid)), (getprivatedata(userid)))
So that there's an isolation provided by the extra parentheses, apparently superfluous:
Having to use these extra parentheses everywhere is really a very bad trick that programs should never depend on!
And anyway I still do not see any reason for the type(value) builtin function to generate an error instead of returning "nil" when its argument list is empty, given that it just has to process the single argument arg[1] and ignores arg[2] or everything else, independantly of the effective length of the argument list computed and passed by the caller.
Checking if parameters are properly bound is something impossible to check if you have declared the function with named parameters (which are in fact declaring local variables initialized with arg[1], arg[2], etc. in the order of the declaration, where "arg" is the implicitly declared local variable added in every function and pointing to its argument list (accessible like a table indexed by integers, but still not necessarily a sequence).