Lua: Difference between revisions

From NixOS Wiki
imported>Makefu
Created page with "== #! nix-shell with lua interpreter == To use a nix-shell shebang with lua you will need to use following structure: <syntaxHighlight lang=lua> #! /usr/bin/env nix-shell --[..."
 
imported>Samueldr
m Some formatting
Line 11: Line 11:
</syntaxHighlight>
</syntaxHighlight>


Some background by [[User:Samueldr|samueldr]]:
Some background by [[User:Samueldr|samueldr]]<ref>https://reddit.com/r/NixOS/comments/q7ns3l/interpreter_with_lua/</ref>:
    Two inter-twined fun facts.
    *    Lua only skips one shebang line.
    *    nix-shell doesn't require its magic lines to be right after the first line.


<blockquote>
Two inter-twined fun facts.


* Reference: https://reddit.com/r/NixOS/comments/q7ns3l/interpreter_with_lua/
* Lua only skips one shebang line.
* nix-shell doesn't require its magic lines to be right after the first line.
</blockquote>

Revision as of 03:41, 15 October 2021

#! nix-shell with lua interpreter

To use a nix-shell shebang with lua you will need to use following structure:

#! /usr/bin/env nix-shell
--[[
#! nix-shell -i lua -p lua
]]

print("this is from lua")

Some background by samueldr[1]:

Two inter-twined fun facts.

  • Lua only skips one shebang line.
  • nix-shell doesn't require its magic lines to be right after the first line.