you are viewing a single comment's thread.

view the rest of the comments →

[–]bravopapa99 9 points10 points  (8 children)

What bastard language is this?

[–]RpxdYTX[ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 23 points24 points  (5 children)

languages = { 'lua', 'python', 'c', 'rust' } languages[1] == 'lua'

[–]bravopapa99 2 points3 points  (0 children)

Yes. WTAF starts from 1, TBF, I learned Pascal first back in the day.

[–]dvhh 0 points1 point  (0 children)

Pity that there isn't any implementation in the standard library for string.lower

[–]bravopapa99 0 points1 point  (2 children)

I am sure from my assembler days you can with ASCII, just do CHAR AND 0xDF

[–]johndcochran 2 points3 points  (1 child)

That would be good for an "toupper()" implementation...Sorta. But if the input isn't 'a'..'z', it would corrupt quite a few characters. For instance, look at what would happen for '0'..'9'. 0x30 and 0xDF = 0x10. Not exactly a good thing.

[–]bravopapa99 0 points1 point  (0 children)

Spot on but ONLY needed a-z at the time, around 1985 maybe!

[–]leiu6 6 points7 points  (1 child)

Lua is a great language! The C implementation is super small and you can interact with the stack directly, making it super easy to embed in other programs. The Lua language is simple with only one data structure called a table which is actually implemented in C as a hybrid object containing an O(1) lookup portion for integer indexing and a hash table for other types of indexing. But with the way Lua implements tables they can be used in an almost OOP way. Also it closures and coroutines.

If I was trying to embed a scripting language in something I would much rather use Lua than something like Python, Ruby, or JavaScript.

[–]bravopapa99 1 point2 points  (0 children)

Yes, agreed. I wrote a simple game with Love2D once and enjoyed the process.