luajit Questions

3

Solved

I have some cpp files, and I want to combine them with LuaJit using FFI. But the problem is that, I have to add extern "c" symbols for almost every function to make it possible for FFI to access t...
Companionway asked 26/8, 2016 at 8:40

2

Solved

I have a question regarding NGINX rate limiting. Is it possible to do rate limiting based on the decoded value of JWT token? I cannot find any information like this in the docs. Or even if there is...
Porbeagle asked 8/10, 2020 at 13:45

2

Solved

I am sketching a small C++ program that will pass arrays to Lua and have them modified there, where I intend to have a lua script read in the program so I can modify it without needing to recompile...
Arse asked 6/11, 2020 at 0:40

0

Using string.format() (which supposedly defers to C's sprintf())) to format a number in LuaJIT rounds differently than every other Lua interpreter I've tried: $ lua -v Lua 5.4.1 Copyright (C) 1994-...
Metastasize asked 27/10, 2020 at 20:2

3

Solved

This: local ffi = require "ffi" ffi.cdef[[ int return_one_two_four(){ return 124; } ]] local function print124() print(ffi.C.return_one_two_four()) end print124() Throws an error: Error:...
Freethinker asked 16/12, 2018 at 19:51

4

Solved

I am writing a small Lua project and using Luarocks to install my 3rd-party dependencies. The default Lua version on my machine is 5.2 and up to this point everything is working just fine. However...
Counterrevolution asked 2/12, 2013 at 5:39

2

Solved

On 64-bit platforms, LuaJIT allows only up to 1-2GB of data (not counting objects allocated with malloc). Where does this limitation come from, and why is this even less than on 32-bit platforms?
Kincaid asked 2/2, 2016 at 13:57

2

Solved

I'm in the middle of writing a small application that needs to read some complex binary messages in LuaJit. I've been using the bit module and string.rep a lot. However, it's all very cumbersome. ...
Clamper asked 10/9, 2012 at 0:22

4

The LuaJIT FFI docs mention that calling from C back into Lua code is relatively slow and recommend avoiding it where possible: Do not use callbacks for performance-sensitive work: e.g. consider a...
Ascent asked 8/9, 2012 at 8:9

1

Solved

I'd like to have a write-once table in Lua (specifically LuaJIT 2.0.3), so that: local tbl = write_once_tbl() tbl["a"] = 'foo' tbl["b"] = 'bar' tbl["a"] = 'baz' -- asserts false Ideally, this wo...
Astred asked 3/11, 2017 at 0:29

1

Solved

From what I understood, the standard Lua interpreter first compiles the input code to "bytecode" (the output of luac) and then "interpretes" that bytecode. But isn't that basically the definition ...
Argentum asked 2/3, 2017 at 22:15

3

Solved

The overview is I am prototyping code to understand my problem space, and I am running into 'PANIC: unprotected error in call to Lua API (not enough memory)' errors. I am looking for ways to get ar...
Samaniego asked 19/11, 2014 at 10:58

1

Solved

Looking at the default Lua cpath with luajit: luajit -e "print(package.cpath)" I get: ./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/luajit/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so Wha...
Sapwood asked 3/12, 2016 at 22:12

2

Solved

I just started tinkering with Luajit with C++ and I see that it's FFI is really easy to use but I am not sure if it is the best solution for all (or at least most) cases. So is it better to use on...
Plasmo asked 21/4, 2013 at 13:45

2

Both the JVM and the .NET CLR include Just-In-Time compilers which support multiple user threads. However, I believe these are method-at-a-time JITs. All of the tracing JITs I am aware of, for exa...
Cum asked 6/9, 2016 at 3:10

4

I would like to know when the user from a command line presses control-c so I can save some stuff. How do I do this? I've looked but haven't really seen anything. Note: I'm somewhat familiar wit...
N asked 1/9, 2015 at 17:27

4

Solved

lua -e "print(package.path)" ./?.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua;/usr/lib/lua/5.1/?.lua;/usr/lib/lua/5.1/?/init.lua luajit -e "print(package.path)" ./?.lua;/us...
Sauerkraut asked 23/7, 2011 at 22:1

2

Solved

I recently looked into Lua and it seems really nice. The only annoying thing is its lack of (standard) libraries. But with the JIT compiler comes along a nice FFI C interface. Coming from a java ...
Merissa asked 17/4, 2011 at 8:14

3

Solved

Torch is a scientific computing framework with wide support for machine learning algorithms. It is easy to use and efficient, thanks to an easy and fast scripting language, LuaJIT, and an underlyin...
Assail asked 20/1, 2015 at 20:52

3

Solved

When I use the following script: local smtp = require("socket.smtp") local from = "from@host" local rcpt = "rcpt@host" local msg = { headers = { to = rcpt, subject = "Hi" }, body = "Hello" } ...
Functional asked 7/5, 2015 at 21:15

1

Solved

I have to train a convolutional neural network using the Torch framework and then write the same network in C. To do so, I have to read somehow the learned parameters of the net from my C pr...
Maddie asked 5/5, 2015 at 14:43

1

Solved

Using the recent luaJIT lua_open returns null. This does not happen with the regular lua library. lua_State *L = lua_open(); std::cout << L << std::endl; Output: 0x0 How can I get l...
Renfroe asked 31/12, 2013 at 14:42

1

Solved

I am writing some test scripts for my Lua project and I want to be sure that they run correctly under the different Lua versions available. Since my unit testing framework can use the wrong Lua ver...
Liquidate asked 2/12, 2013 at 18:35

2

Solved

I've been reading up on JIT's and LuaJIT's trace compiler in particular, and I ended up with some questions. From what I understand, LuaJIT's JIT doesn't compile hot methods like Java's HotSpot do...
Bushranger asked 28/11, 2013 at 12:41

3

Solved

I'm trying to embed LuaJIT into a C application. The code is like this: #include <lua.h> #include <lualib.h> #include <lauxlib.h> #include <stdlib.h> #include <stdio.h&g...
Mola asked 7/5, 2011 at 7:37

© 2022 - 2024 — McMap. All rights reserved.