minus-squareDie Martin Die@sh.itjust.workstoProgrammer Humor@programming.dev•Python needs an actual default functionlinkfedilinkarrow-up14·edit-210 days 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. linkfedilink
if 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.