Maybe i wasn't clear, i do not mean the variable _. But a variable name of e.g. _number. This is of course some aesthetic choice, but when and why is it used?
ok so _ is actually a variable that you can reuse later if you wish, i cant speak for everyone on the forums, but personally I use the _ identifier to indicate to myself a variable that I do not care about and/or never use…
as for variable names that begin with an _, these are in programming commonly referred to as properties, and you will see quite common in Object-Oriented programs. These are again just a developers choice and are not required, it just helps us a programmers know and quickly see what are the internals of our objects and/or programs, and what we really shouldn't be messing with, and if we do, could cause some unexpected results.
I don't think select is lua side i think it is in the java implementation of the lua environment so some over head's may be saved there i think it is for when you have a lot of returned variables like 15 or 20 and using "_" would be difficult. the table methods JokerRH uses is personally the one i use didn't for fill the specifications of the question so i didn't mention it.
But still, since the returned values should be put to the stack they'll use memory anyway…
Really when the values are returned they go onto the heap then the way Lua deals with it the variable _ gets the first return, then it gets overridden with the second, then the third, etc, etc, etc… so while the objects are put onto the programs heap, they wouldn't last too long taking up memory, LuaJ would clean them up. Really memory isn't something to worry about in this sense anyways. we have heaps of memory for Lua programs. if this was something like a proper Java program or something for a mobile device, then yes, memory is expensive and we should reduce its usage, but in this case, meh.
EDIT: With the select function it must not be a table. you must use unpack on tables…
as shown hereAlso just for a bit of diversity, here is another way to get the second or so return value from a function. Not saying its a good way, actually select is better, however, this still works :)/>
local msg = ({rednet.receive()})[2]
this packs the values into a table and then gets the second value from that table…
first time i've ever seen it, so i've learnt something new today :P/>
yeh i didn't know about it until about a month ago when I saw it in one of the CC Devs programs and was like "WHAT IS THAT?!" then I googled and found the above link…