Lua: Difference between revisions

From NixOS Wiki
imported>Samueldr
m Some formatting
imported>Qyriad
Link to Lua's nixpkgs manual section in See Also
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:


<syntaxHighlight lang=lua>
<syntaxHighlight lang=lua>
#! /usr/bin/env nix-shell
#!/usr/bin/env nix-shell
--[[
--[[
#! nix-shell -i lua -p lua
#!nix-shell -i lua -p lua
]]
]]


Line 19: Line 19:
* nix-shell doesn't require its magic lines to be right after the first line.
* nix-shell doesn't require its magic lines to be right after the first line.
</blockquote>
</blockquote>
== See Also ==
* [https://nixos.org/manual/nixpkgs/stable/#users-guide-to-lua-infrastructure Lua user guide in the nixpkgs manual]

Latest revision as of 22:07, 3 November 2023

#! 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.

See Also