Questions tagged [luajit]

LuaJIT is a Just-In-Time Compiler for the Lua programming language. LuaJIT offers more performance, at the expense of portability. On the supported OS's (all popular operating systems based on x86 or x64 CPUs (Windows, Mac OSX, Linux, ...), ARM based embedded devices (Android, iOS) and PPC/e500v2 CPUs) it offers an API- and ABI-compatible drop-in replacement for the standard Lua interpreter.

Overview

LuaJIT is a high-performance, Just-In-Time(JIT) implementation by Mike Pall for the Lua programming language. It has been successfully used as a scripting middleware in games, 3D modelers, numerical simulations, trading platforms and many other specialty applications. It combines high flexibility with high performance and an unmatched low memory footprint: less than 125K for the virtual machine(VM) plus less than 85K for the JIT compiler (on x86).

LuaJIT has been in continuous development since 2005. It's widely considered to be one of the fastest dynamic language implementations. It has outperformed other dynamic languages on many cross-language benchmarks since its first release — often by a substantial margin. In 2009 other dynamic language VMs started to catch up with the performance of LuaJIT 1.x. Well, I couldn't let that slide. ;-)

2009 also marks the first release of the long-awaited LuaJIT 2.0. The whole VM has been rewritten from the ground up and relentlessly optimized for performance. It combines a high-speed interpreter, written in assembler, with a state-of-the-art JIT compiler. An innovative trace compiler is integrated with advanced, SSA-based optimizations and a highly tuned code generation backend. This allows a substantial reduction of the overhead associated with dynamic language features.

It's destined to break into the performance range traditionally reserved for offline, static language compilers.

Compatibility

LuaJIT implements the full set of language features defined by Lua 5.1. The virtual machine is API- and ABI-compatible to the standard Lua interpreter and can be deployed as a drop-in replacement.

LuaJIT offers more performance, at the expense of portability. It currently runs on all popular operating systems based on x86 or x64 CPUs (Linux, Windows, OSX etc.) or embedded systems based on ARM (Android, iOS) or PPC/e500v2 CPUs. Other platforms will be supported in the future, based on user demand and sponsoring.

388 questions
0
votes
1 answer

How to print a fixed array of char in LuaJIT?

I'm trying to print the contents of a null terminated string that is stored in a fixed array. The array is memset'd to zero at the start and then is populated with a null terminated string. I'm attempting to print the string. This…
010110110101
  • 12,347
  • 23
  • 83
  • 149
0
votes
2 answers

How to merge clib functions into a table using LuaJIT and FFI?

I have a table/object defined in Lua. I'm trying to add some methods from a C-API dll. I could attach the methods one at a time, but there are a lot of them. The last line of the code below is how I would like to do it. It is supposed to merge…
010110110101
  • 12,347
  • 23
  • 83
  • 149
0
votes
0 answers

C++ and Lua5.1-2 / LuaJIT

So I'm working on embedding Lua5.1-2 using LuaJIT in a C++ application and included the ability for lua scripts to "subscribe" to events raised in the C++ code and successfully stored the function reference using luaL_ref and successfully called the…
Chipper
  • 1
  • 1
0
votes
1 answer

LuaJit - Get metatable from module/package and assign it to userdata

Say I have this metatable for a custom struct vector2_t which is inside a module mymod like this: local mymod = {} local ffi = require("ffi") local C = ffi.C ffi.cdef[[ typedef struct { double x; double y; }…
Sandu Liviu Catalin
  • 1,902
  • 2
  • 20
  • 42
0
votes
1 answer

Pointers and Reference issue in LuaJIT FFI

I have this function (written in C++ here): GameSession *theSession = NULL; ... ... startSesion(&theSession) I have managed to get this running properly using the LuaJIT FFI here: local session = ffi.new("GameSession*[1]",…
theman
  • 345
  • 1
  • 10
0
votes
0 answers

luaposix msgget function doesn't create the queue

I'm playing with luaposix module (using luajit) trying to learn how to fork process and demonize it. Here is the code that create a new process and try to set up a msg queue for communication with the child. I use the function msgget(key) to create…
msalese
  • 596
  • 1
  • 5
  • 18
0
votes
1 answer

Creating a struct of callbacks in LuaJIT FFI

So first I load in a DLL I need local ffi = require("ffi") local theDLL = ffi.load("thisDLL") in the ffi cdef I have this struct ffi.cdef [[ typedef struct { /* * begin_proj callback */ bool (__cdecl…
theman
  • 345
  • 1
  • 10
0
votes
2 answers

PostgreSQL and pllua

I'm trying to build the pllua module but I'm having some trouble. I think that the problem is on the wrong PostgreSQL version but I'm not sure, I'd be grateful if someone could help me. Postgres location: /opt/PostgreSQL/9.3/bin (is the…
msalese
  • 596
  • 1
  • 5
  • 18
0
votes
1 answer

Lua (LuaJit) cURL curl_easy_getinfo does not work as expected

I am trying to get the info CURLINFO_RESPONSE_CODE and CURLINFO_CONTENT_TYPE with curl_easy_getinfo, but both tries seem to fail. Like in a LuaJit/scanf example, I'm allocating ffi.new("int[1]") to get one element as a pointer and use it as…
kungfooman
  • 3,696
  • 1
  • 32
  • 25
0
votes
1 answer

Lua (LuaJit) cURL curl_easy_perform is always returning CURLE_URL_MALFORMAT (3)

I'm trying to use libcurl.dll with LuaJit, but curl_easy_perform always returns CURLE_URL_MALFORMAT (3) This is my actual code (code fixed): url = [[http://static02.mediaite.com/geekosystem/uploads/2013/12/doge.jpg]] ffi.cdef [[ int…
kungfooman
  • 3,696
  • 1
  • 32
  • 25
0
votes
1 answer

Passing pointer to int in LUA FFI

I have a C function as follows ffi.cdef[[ typedef struct { int index; char name[10]; } entry_key_t; extern entry_t *lookup_entry(entry_key_t *key, int *err); ]] I am having trouble passing the "int *" and I have tried the following…
0
votes
1 answer

Suricata luajit compilation error

I'm currently trying to compile suricata (http://suricata-ids.org/) with luajit support on my arch linux distribution with these commands: ./configure --enable-luajit --with-libpcap-includes=/usr/local/pfring/include…
E-Kami
  • 2,129
  • 4
  • 25
  • 41
0
votes
1 answer

luajit mode with C API

I'm starting at LUAJIT. LUAJIT has a function to set mode LUA_API int luaJIT_setmode(lua_State *L, int idx, int mode); Is there any way to get actual mode ? Thanks
fgarbin
  • 1
  • 2
  • 2
0
votes
1 answer

msvcbuild - how to compile luajit

i'va just downloaded luajit and trying to compile it. i'm doing everything as it says here to compile it i should execute msvcbuild from VS .NET Command Promt. so i installed VS 2010 and started VS 2010 Command Promt and when i try to execute…
SuperYegorius
  • 656
  • 5
  • 21
0
votes
1 answer

openRTMFP cumulus how to compile and install

i've just downloaded cumulus, POCO, OpenSSL and LuaJIT and visual studio. now i'm trying to compile it as it said in instruction here however i've never used visual studio and i've never programed on visual c. so i'm stuck at the very begining. in…
SuperYegorius
  • 656
  • 5
  • 21
1 2 3
25
26