Skip to content
Advertisement

How to execute lua bytecode genrated by luac on linux

I have a simple lua source code called hello.lua

print('Hello Lua')

I complied this file to bytecode on a RedHat Linux machine , using Lua5.3.4 as follows:

luac -o hello.luac  hello.lua
chmod +x hello.luac
./hello.luac 
bash: ./hello.luac: cannot execute binary file

The architecture should be fine I guess. I cant figure what is wrong.

Advertisement

Answer

Precompiled Lua programs are run exactly the same way as source:

lua hello.luac
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement