Skip to main content

Questions tagged [lua]

For code written in Lua, or built to interface with Lua (e.g. native code providing Lua functions).

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 ...
zziccardi's user avatar
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 ...
Dair's user avatar
  • 6,220
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 ...
Eric's user avatar
  • 151
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 ...
Loki Astari's user avatar
  • 97.7k
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&...
Loki Astari's user avatar
  • 97.7k
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 ...
dustytrash's user avatar
  • 2,446
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? ...
user3204810's user avatar
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 ...
user3713179's user avatar
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 ...
Thiago Luiz's user avatar
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 ...
luanoob's user avatar
  • 41
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. ...
wellinthatcase's user avatar
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 ...
henriquehbr's user avatar
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 ...
YvesgereY's user avatar
  • 458
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 ...
Nick's user avatar
  • 1,656
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 ...
Rebecca's user avatar
  • 41

15 30 50 per page
1
2 3 4 5
8