All Questions
365
questions
-1
votes
0
answers
27
views
custom lua_Alloc: Segmentation fault
I want to replace the realloc
perf_state.orgAlloc = lua_getallocf(L, NULL);
lua_setallocf(L, cst_lua_Alloc, NULL);
static void *cst_lua_Alloc(void *ud, void *ptr, size_t osize, size_t nsize) { ...
2
votes
0
answers
31
views
Can I change the default hash function?
I is possible to change the default hash function that lua (or luajit) uses for the HashTable part of a talbe ?
I want to speedup table access in pure Lua.
I saw that:
The Default hash function for ...
0
votes
0
answers
36
views
Which .dll file do i choose for setting up luajit?
I'm trying to get LazyVim/NeoVim setup and I need to build with luajit, but I wasn't able to do the instructions:
Copy luajit.exe and lua51.dll (built in the src directory) to a
newly created ...
0
votes
1
answer
40
views
How to call the destructor on a Lua object twice to catch double free?
I need to write a test that diagnoses double free for a Lua object created using ffi.new.
As a result, you need to call collectgarbage() twice, after which a double free situation should occur.
I ...
3
votes
1
answer
63
views
Where does Neovim's Lua List type come from?
Edit
This question was very misguided - the feature I'm referring to is from vimscript, not Lua.
Original question
In Neovim's Lua, in addition to normal table objects, you can create List objects ...
0
votes
0
answers
40
views
Linking with lua5.1 and luajit
I've a c library with lua bindings, I link the library with -lua5.1 and then uses it from lua5.1 or from openresty on linux and it all works fine.
However on OS X it silently crashes. After some ...
1
vote
1
answer
70
views
How to get the value of char* in lua
I am tring to call c function in lua, the c function is in a so file and code is like this:
typedef struct attributes_s {
char name[256];
char id[256];
}attributes_t
int get_service_instances(...
0
votes
1
answer
76
views
With LuaJIT, how could I associate more than one metatable with a C struct?
I'm currently working on my own game engine, which uses C and LuaJIT, and I'm working on scripting for my entity hierarchy. As part of my hierarchy's design, I have a single node struct here, and I ...
0
votes
0
answers
114
views
Lua GC is not collecting automatically
I'm kinda new to lua although I've already used this language other times and I've read quite a bit about it. Now I'm using it for the second time as my scripting language for a C++11 project. The ...
2
votes
1
answer
253
views
How to get better performance out of Lua when iterating array of structs
Problem:
Iterating an array of structs in Lua and manipulating the data, that is than used in C++ later on.
Backstory:
I did some performance testing this week and I am kind of disappointed by the ...
0
votes
1
answer
77
views
How to use require in Discordia(luvit)
So when i just use require(filename) it doesn't work, i mean if i use require("filename"), it thinks it's a module so can't open it, it only works if i use require("./filename.lua")...
0
votes
0
answers
82
views
Luajit can't locate modules installed via Luarocks
I'm to use a luarocks installed module with luajit but I get this error.
luajit-2.1.0-beta3: ./lex.lua:2: module 'lua-utf8' not found:
no field package.preload['lua-utf8']
no file './...
0
votes
1
answer
57
views
Encountered problems using luajit and fii libraries
In LuaJIT, the so is loaded through the fii library, and the functions in the so are called, but in the loaded so, the variables used by some methods are defined through extern. For example, the ...
1
vote
1
answer
89
views
How can I make LuaJIT non-blocking with select or epoll?
I'm using LuaJIT's ffi to call the epoll C library. However, epoll blocks when there are no events, and my software needs to perform other tasks at that time. In C, I know I can execute epoll in a ...
0
votes
1
answer
392
views
using luajit installed with vcpkg
I've a c++ project that uses cmake and vcpkg. I want to install and use luajit.
I've added it in my vcpkg.json:
{
"name": "myproj",
"version": "1.0.0",
&...