Re: godawful sh/Lua polyglot
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: godawful sh/Lua polyglot
- From: Sam Trenholme <lua@...>
- Date: 2020年8月12日 13:05:55 -0700
Here is a related ugly Lua/Python polyglot:
#!/usr/bin/env python
_rem={}
_rem={ #_rem --[=[
}
# Python code
""" # ]=] }
-- Lua code
_rem={ #_rem --[=[
""" # } ]=] }
I use a simpler version of this so I can have code which declares a
table in both Lua and Python with comments for both Lua and Python.
— Sam
On 2020年08月12日 11:19, Egor Skriptunoff wrote:
Nice idea with if-false-then-else!
Another way is to start with variable assignment:
#!/bin/sh
a=a--[[
...shell code...
]]
...Lua code...