[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: godawful sh/Lua polyglot
- From: Marc Balmer <marc@...>
- Date: Wed, 12 Aug 2020 22:37:10 +0200
You guys should really decide in which language to write your software....
> Am 12.08.2020 um 22:06 schrieb Sam Trenholme <lua@samiam.org>:
>
> 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...