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
2
votes
2 answers

How to bring debugging information when encryption then lua code use luac

I wrote the following code in the file "orgin.lua" if test==nil then print(aa["bb"]["cc"]) -- to produce a crash end print(1120) when it crash ,it will generate the following information: lua: origin.lua:3: attempt to index global 'aa' (a nil…
2
votes
1 answer

Passing array to C as argument in the stack

I use Lua for arrays manipulating; arrays are simple binary data: local ram_ctx = {0,0,0,0,0,0,0,0,0} I want to pass it to GUI written in C. The problem is if I pass it directly like func(ram_ctx), Lua function seems to stop executing after a call.…
pugnator
  • 665
  • 10
  • 27
2
votes
3 answers

Do any .NET DLLs exist that implement luac's functionality?

Does anyone know of any DLLs (preferably .net) that encapsulate the lua 5.1 compiler? I'm working on a .net project where part of it needs to compile lua scripts, and i would rather have a DLL that i could send script code to instead of sending the…
Kevlar
  • 8,804
  • 9
  • 55
  • 81
2
votes
1 answer

Luac don't work with one script

I have embedded lua and I want precompile my script. For that, I call the main of luac (with argc the number of file is 1). My problem is on the function doargs of luac. I don't understand the use of the variable i. Because when I use one script.…
Subas
  • 65
  • 6
1
vote
2 answers

Lua C - Is there a way to keep a value in C, but still have it not garbage collected?

I am creating a thread in lua c, but i want to keep it just in C, without making it a variable in the environment/etc. But when i throw away the thread value that gets pushed by lua_newthread, it gets garbace collected shortly after, and so becomes…
Artemking4
  • 31
  • 7
1
vote
1 answer

How to make a structure in C language with lua c api

How to create the following C language structure using Lua c api? typedef struct _c{ int d; } obj_c; typedef struct _b{ obj_c c[4]; }obj_b; typedef struct _a{ obj_b b; }obj_a; obj_a a[4]; The above structure in lua a[1].b.c[1].d = 1; I…
P.Kwon
  • 21
  • 2
1
vote
0 answers

Can you add an upvalue to a closure which was created with none?

I've been attempting to change the address of a Lua Closure and then use a wrapping function which requires the upvalue of the function be passed to it. The only issue is when I change the address of the function and try to move over the upvalue it…
1
vote
1 answer

how to get assembly code from .lua or from byte code?

i'd like to study assembly code from lua code. for the moment , i can get byte code with command : luac filename.lua I work on linux platform, how to compile it ? Should i compile it in order to study his assembly code ? how to disassemble it ?
laticoda
  • 100
  • 14
1
vote
0 answers

How to merge singular files into a single file(note: both files are of different types)

I have confirmed that this has been done before, however the person who did this refuses to share how it was done so I'm basically trying to figure it out myself instead of waiting for somebody to change their mind and such. Basically they managed…
1
vote
1 answer

Embed luac-bytecode into C/C++ source-file

How do you include a lua-bytecode-string into a C/C++ file ? $ luac -o test -s test.lua $ cat test LuaS� xV(w@@A@$@&�printTestj Now if you could insert this byte-string into a C/C++-file, you could actually luaL_loadfile(lua,…
user1511417
  • 1,880
  • 3
  • 20
  • 41
1
vote
0 answers

LuaC Library: Access violation with certain function(s)

I've written a relatively basic C++ lua module using Visual Studio 2017. It exports functions from an application which can then be called from a lua script running within said application. It appeared to work fine for the most part, except for the…
Stephen P.
  • 11
  • 2
1
vote
0 answers

Quickly dumping large tables passed from Lua to C

In order to quickly save Lua tables containing large 1-dimensional arrays (the number of arrays is known however the number of elements isn't fixed. approximately 800,000 elements in each array), I planned to use Lua C binding in the following…
ravi
  • 6,140
  • 18
  • 77
  • 154
1
vote
1 answer

Lua C API Custom Print function, not called when a space is passed in the string

Problem Description: I have created a custom C++ function print() that is supposed to be pushed as a global onto a table to so the user can use the print() function to print to the debug console. This function works to some extent, however, when you…
Tim Hardly
  • 129
  • 4
1
vote
2 answers

Lua C function call returns nil

I wrote a simple C plugin for Lua: #include "lua.h" #include "lualib.h" #include "lauxlib.h" static int bar (lua_State *L) { double arg1 = luaL_checknumber(L, 1); double arg2 = luaL_checknumber(L, 2); lua_Number res = arg1 + arg2; …
m_vdbeek
  • 3,704
  • 7
  • 46
  • 77
1
vote
1 answer

Compile lua5.2 files to one with using require and dofile

Can I compile all my files to one and then execute from C. In my lua files I am using require and dofile functions. When I try to use luac for compiling and then I want to execute the compiled file then It will not be able to find my modules which…