Compiling a lua script into a standalone executable

Is there a way to create a standalone executable from simple lua scripts? simple i mean: i just use what lua 5.1 provides.

if so, is there some kind of "cross-compiler"? I would like to create binaries for the linux system on my mac osx system.

early!

+3
source share
5 answers

You can execute Lua executables with chmod +xand add #!/usr/bin/env lua. But you will need to install a Lua interpreter. For a different approach, see srlua .

+7
source

murgaLua squish lua 1 ( ).

+4

"" .

, lua, lua, (, , ).

, script .

lua2bin ( ), lua script c , .

+1

try using Lua bin2c, which will give you the C source code of your lua script. If you use external lua libraries, it might be a little harder to take off, but squishing can help with that. Or you can just luaL_loadstring all

0
source

LuaJIT 2.0.4 was released on 2015-05-14
(I use it on debian based linux (Crunchbang)

http://luajit.org

$ luajit -v
LuaJIT 2.0.4 -- Copyright (C) 2005-2015 Mike Pall. http://luajit.org/
$ luajit -e 'print(_VERSION)'
Lua 5.1

(put this at the top of your script)
 #! / usr / bin / env luajit

0
source

Source: https://habr.com/ru/post/1780639/


All Articles