Derp, I misread.
Die Martin Die
Just a hobbyist programmer.
- 0 Posts
- 12 Comments
Kinda.
Lua defines it implicitly only when you use the
function foo:bar(a, b, c) -- note the colon
syntactic sugar, which gets translated to
function foo.bar(self, a, b, c) -- note the period
In all cases,
self
is a regular variable name. You can even redeclare a new local with that name even when the old one is in scope.Edit: some typos
Die Martin Die@sh.itjust.worksto Programmer Humor@programming.dev•Python needs an actual default function14·1 month agoif debug.getinfo(1).what == "main" then -- ... end
Not that you’ll ever use it. No, seriously.
Edit: actually, they are not quite equivalent. This code just checks whether we are outside any function, not necessarily in the main file (i.e. not in a module). I don’t think there’s an equivalent to Python’s
__name__
in stock Lua.
Die Martin Die@sh.itjust.worksto Android@lemmy.world•Japan Orders Google to Stop Forcing Search and Browser on Android PhonesEnglish3·3 months agoFennec here (Firefox with less telemetry, and not enabled by default)
Die Martin Die@sh.itjust.worksto Programmer Humor@programming.dev•Does this exist anywhere outside of C++?7·3 months agofprintf(stdout, "%c", '\012');
Die Martin Die@sh.itjust.worksto Programmer Humor@programming.dev•When you look at code you wrote last year4·4 months agos/year/week/
Die Martin Die@sh.itjust.worksto Programmer Humor@programming.dev•TIL that "nginx" is pronounced "engine-x", and not "n-jinx"3·4 months agoEn-eh hinks (with heavy Spanish accent)
Capital letters are bigger, thus they use bigger bytes and use too much disk space and memory. That’s why most programming languages use lowercase, and why the most common loop variable is
i
.
Die Martin Die@sh.itjust.worksto Piracy: ꜱᴀɪʟ ᴛʜᴇ ʜɪɢʜ ꜱᴇᴀꜱ@lemmy.dbzer0.com•Meta Says it Made Sure Not to Seed Any Pirated Books.English12·5 months agoYou hope! Laws will still apply to us peasants
Die Martin Die@sh.itjust.worksto Piracy: ꜱᴀɪʟ ᴛʜᴇ ʜɪɢʜ ꜱᴇᴀꜱ@lemmy.dbzer0.com•Meta Says it Made Sure Not to Seed Any Pirated Books.English32·5 months agoIt will probably work. Because, you know, money.
Die Martin Die@sh.itjust.worksto Programmer Humor@programming.dev•The government doesn't use SQL4·5 months agoPhony Stark*
Supposotory*