Pass this as the first argument:
C=("").char;_G[C(112,114,105,110,116)](C(72,101,108,108,111,44,32,87,111,114,108,100,33))
Assuming the original code is in a file tehtmi.lua
, run (in bash or a similar shell):
lua tehtmi.lua 'C=("").char;_G[C(112,114,105,110,116)](C(72,101,108,108,111,44,32,87,111,114,108,100,33))'
It also works on Lua 5.3, which is what TIO uses, so why don't you try it online? I haven't tested on a implementation that uses the "PUC-Rio's Lua 5.1" core (because I can't really find any information), but my solution probably also works there.
How?
It runs the first argument as code, but only if it contains less than 5 lowercase characters.
The trick is to run print("Hello, World!")
. Another way this can be run is using _G["print"]("Hello, World!")
, which only uses strings.
But we can't use the string directly due to the lowercase-count restriction, however, you can run ("").char
to get the function string.char
, that can convert from a series of bytes to a string. I assigned it to an uppercase variable (so we don't hit the limit) so we can use it to construct both the print
and the Hello, World!
strings that can be used like above.