Questions tagged [lua]
For code written in Lua, or built to interface with Lua (e.g. native code providing Lua functions).
107 questions
2
votes
1
answer
89
views
Encapsulating status codes and messages à la absl::Status
I'm new to Lua and thought a decent way of familiarizing myself with the language would be to implement some basic utility functionality around status codes. In particular I've reimplemented a subset ...
3
votes
0
answers
119
views
Autoshooter game in Love2d
I ported a little game I originally made in Macroquad to Love2d. But I have also added additional features, like additional animations and screen shake. I have used HUMP for various utilities. shack ...
3
votes
1
answer
101
views
<Programming in Lua - 4th> exercise 2.2 - place 8 queens
About exercise 2.2
Place N queens on N*N board, 1 queen per line, so that all queens are safe.
Use permutation to improve the provided implementation from book.
The ...
3
votes
1
answer
80
views
Run UNIT TEST automatically from NeoVim
Still working on my neovim configuration.
I use Google test to write my unit tests. Which means that all the unit test begin with ...
3
votes
0
answers
53
views
Add DAP debugging to NeoVim on Mac
Upgrading from vim to neovim (on the mac).
Part of this is to get the DAP debugger working from inside neovim.
I have "Lazy&...
5
votes
1
answer
108
views
RandomNumber wrapper in Lua
This is a wrapper I wrote for math.random(). I have a larger program that will create a JSON file to 'load' from when I want to resume. However my program heavily ...
1
vote
2
answers
117
views
Try to not repeat function in Lua
There is a way to not rewrite the same part (the cycle for i = 1...end) twice?
...
4
votes
1
answer
5k
views
Inverting a boolean in Lua
Is there a more elegant way to set this boolean value?
SetScript() is a game API, while "OnClick" is its handler. What ...
1
vote
2
answers
327
views
function to print any type in Lua?
I'm learning Lua for about a week now and I've built (I hope) a function to print any type in Lua. As I'm new to Lua I don't quite understand:
if there is a more succinct way to achieve this
if ...
4
votes
0
answers
250
views
First Lua program - Print external IP and VPN status
I started learning Lua yesterday and wanted to write a quick program as a practice.
It queries an external service for the IP address and country code, and naively check for the existence of network ...
3
votes
1
answer
133
views
Trailing delimiter string splicing, implemented for Lua in C
I've been writing with C for a couple days, so this is a relatively advanced function compared to the simple things I've been doing previously. It's written for the Lua API, but it's still C.
...
1
vote
2
answers
6k
views
Get list of buffers from current neovim instance
The function below is written in Lua and returns the list of buffers from the current neovim session, it also allows the option to specify a optional table (object) as a parameter, with a ...
8
votes
2
answers
319
views
3D torus in Lua
I'm a total beginoob in Lua. The aim is to display a 3D Torus in dots (see Figure1), or at least compute the positions, privileging clarity over performance. Pseudocode link.
Don't hesitate to be ...
6
votes
1
answer
341
views
Complex number class in Lua
This is my first attemp with Lua.
I decided to create this class, because it have lots of "tweaks" and "tricks".
I want to know if I did it as best practices Lua ways.
My Lua ...
4
votes
2
answers
657
views
I wrote my first pathfinding algorithm
I'm currently writing a small game in Lua, using the Love2d framework. I guess I'm doing it as a practice of sorts, but it did give me the opportunity to write my first pathfinding algorithm. I wrote ...