David Haley said:
Quote:
I absolutely agree... although assert(loadstring("return %1"))() is almost a necessity just because it fixes the double quotes issue.
But... why are we fixing a double quotes issue for a math calculator? I still am not sure why this is really useful. :-/
Besides, you could just use single quotes...
Admittedly this is a little off from the original "calculator" alias, but a general evaluate-and-print alias is extremely useful. I use double quotes most by force of habit, so having to see an error every time I slip is a pain.
David Haley said:
AFAICT the thing going for the loadstring approach is that it lets you use the metatable trick, which I think is extremely useful: having to type out math.log, math.sqrt, math.pow all the time would get pretty old. (I'm not convinced you need all the other stdlib tables, though.)
You can do it without loadstring, as Nick did in his earlier examples.
WillFa: That's exactly why it's so enticing, IMHO. I've never tried, but you have to work within an interesting set of constraints, and you can do some cool stuff. Look at Tetris in Excel. ;)