Questions tagged [luac]

luac is the Lua compiler. It translates programs written in the Lua programming language into binary files that can be later loaded and executed.

luac is the Lua compiler. It translates programs written in the Lua programming language into binary files containing precompiled chunks that can be later loaded and executed.

The main advantages of precompiling chunks are:

  1. Faster loading;
  2. Protecting source code from accidental user changes;
  3. off-line syntax checking.

Precompiling does not imply faster execution because in Lua chunks are always compiled into bytecodes before being executed. luac simply allows those bytecodes to be saved in a file for later execution. Precompiled chunks are not necessarily smaller than the corresponding source. The main goal in precompiling is faster loading.

Precompiled chunks are not portable across different architectures. Moreover, the internal format of precompiled chunks is likely to change when a new version of Lua is released. Make sure you save the source files of all Lua programs that you precompile.

58 questions
7
votes
2 answers

Can bytecode produced by luac be used on computers with no Lua library?

If I compile a regular .lua file with luac, can the result be ran without the Lua library or interpreter installed?
6
votes
2 answers

lua_touserdata is returning null

I am badly stuck trying to get my userInfo reference. One of my method is returning instance of the object. Everytime createUserInfo is called, it will return the userInfoObject to the lua. However, when I call a method for userInfo object from…
kapser
  • 621
  • 3
  • 11
5
votes
3 answers

Lua - why is string after function call allowed?

I'm trying to implement a simple C++ function, which checks a syntax of Lua script. For that I'm using Lua's compiler function luaL_loadbufferx() and checking its return value afterwards. Recently, I have ran into a problem, because the code, that I…
Electrix
  • 331
  • 5
  • 14
5
votes
4 answers

Can 32bit Lua bytecode work on a 64bit system?

Can a compiled Lua file (32bit *.luac file) work on a 64 Bit system?
luac
  • 51
  • 1
  • 2
5
votes
1 answer

luac.out: incompatible precompiled chunk

I used luac to compile my lua code. The luac version is 5.2.2, and my app native lua is 5.2.2. My lua code function hello() print("hello test luac ") end hello() The precompiled code: 1b4c 7561 5200 0104 0804 0800 1993 0d0a 1a0a 0000 0000…
ricky pu
  • 95
  • 1
  • 8
4
votes
1 answer

Accessing Lua subtables fields from C

I want to store model description in Lua and read it non-sequental. All data is store in incremental order device_pins = { {is_digital=true, name = "A", number = 1, on_time=15000000000, off_time=22000000000}, {is_digital=true, name = "B",…
pugnator
  • 665
  • 10
  • 27
4
votes
6 answers

Lua compiled scripts on Mac OS X - Intel vs PPC

Been using Lua 5.0 in a Mac OS X universal binary app for some years. Lua scripts are compiled using luac and the compiled scripts are bundled with the app. They have worked properly in Tiger and Leopard, Intel or PPC. To avoid library problems at…
SirRatty
  • 1,641
  • 3
  • 17
  • 18
3
votes
1 answer

How to share/reuse a Lua script for multiple entities?

I'm in the design/skeleton coding phase of my C++ game with Lua scripting, but I have run into a design issue: The game will have many copies of the same kind of entities, with behavior controlled by the same script. Is there a straightforward way I…
stands2reason
  • 672
  • 2
  • 7
  • 18
3
votes
1 answer

Compile VLC failing on luac 32-bits needed

Trying to build VLC using the build steps outlined in https://wiki.videolan.org/OSXCompile/ but am failing on luac needing to be 32 bit. Uninstalled lua and reinstalled a bunch, no option to specify a 32 bit install with lua. Am I doing something…
user809260
  • 29
  • 5
3
votes
1 answer

How to run multiple instances of a lua script from C

I have the following lua script : mydata={} function update(val) mydata["x"] = val if (val == 10) -- Call C-Api(1) else --Register callback with C when free or some event happens register_callback(callme) end function…
P K
  • 33
  • 4
3
votes
3 answers

Lua error did not pass boolean

This works... if ( tileType == "water" or ( otherObj and otherObj:GetType() == "IceBlock" )) then self:SetNoClip( true ) else self:SetNoClip( false ) end - These don't... self:SetNoClip( tileType == "water" or ( otherObj and…
random
  • 183
  • 13
3
votes
1 answer

Building Lua 5.0 on 64bit Mac

For compatibility/legacy reasons I need to build the Lua compiler (luac) from version 5.0, on my 64bit Intel Mac. (5.1 or later can't be used.) Dev tools installed through Xcode 4.6's Preferences window. After I 'cd' in to the Lua directory, I…
Womble
  • 4,607
  • 2
  • 31
  • 45
2
votes
1 answer

Compile Lua script to 32 bit bytecode on MacOS

I am compiling a Lua script into a binary on MacOS Catalina. luac -s -o bin/my-binary.luac src/my-code.lua" However, the application consuming the compiled script runs a 32-bit version of Lua and can't read the bytecode of the 64-bit compiled Lua…
Hedge
  • 16,142
  • 42
  • 141
  • 246
2
votes
1 answer

How to decompile a Lua file?

I have a lua file, which, when opened in Notepad++ shows a mixture of English (uncorrupted), understandable text, as well as a mixture of "NULS" "ETX's" and other strange symbols, before I delve into attempting to decompile this, I want to work out…
S.Stevens
  • 378
  • 1
  • 5
  • 18
2
votes
0 answers

Why do LClosures appear to have 2 different upvalues?

So when doing investigation into LCLosures I see it has the same type appearance as CClosures but then further in the proto has upvalues also stored inside of there. #define ClosureHeader \ CommonHeader; lu_byte isC; lu_byte nupvalues; GCObject…
1
2 3 4