Help needed - luarocks test --prepare always erroring on Windows
I'm trying to install a package luarocks. Specifically I want to
1. clone my package
2. install all of its
3. install all of its
4. run the unittests (via busted)
My understanding is that I can do #2 and #3 by calling
I simply cannot seem to get
This is the GitHub workflow run: https://github.com/ColinKennedy/mega.vimdoc/actions/runs/12772422930/job/35601914793
And the logs are here
And the GitHub workflow file
From what I can guess from reading luarocks source code, it looks like unittests are running for some package, somewhere, and instead of showing the error it's just defaulting to the generic
https://redd.it/1i1anib
@r_lua
I'm trying to install a package luarocks. Specifically I want to
1. clone my package
2. install all of its
dependencies3. install all of its
test_dependencies4. run the unittests (via busted)
My understanding is that I can do #2 and #3 by calling
luarocks test my_package-scm-1.rockspec --prepare and then do #4 with luarocks test --test-type busted. #4 is working fine. My problem is with #3. And possibly #2.I simply cannot seem to get
luarocks test --prepare to run on Windows. It looks like despite the luarocks test --help documentation saying that --prepare does not run any tests and just installs dependencies, it looks like --prepare still actually does run some tests. In my logs I can clearly see Error: test suite failedThis is the GitHub workflow run: https://github.com/ColinKennedy/mega.vimdoc/actions/runs/12772422930/job/35601914793
And the logs are here
And the GitHub workflow file
From what I can guess from reading luarocks source code, it looks like unittests are running for some package, somewhere, and instead of showing the error it's just defaulting to the generic
Error: test suite failed error message that can be seen in the logs.https://redd.it/1i1anib
@r_lua
GitHub
Added deps · ColinKennedy/mega.vimdoc@15cd175
A Neovim plugin that converts Lua source code to vimdoc - Added deps · ColinKennedy/mega.vimdoc@15cd175
anyone know why my resource manifest isnt working?
fx_version 'cerulean'
game 'gta5'
author 'Jacobmaate'
denoscription 'FIB Police (FIBP) Pack'
version 'v3.03'
files {
'data/vehicles.meta',
'data/carvariations.meta',
'data/carcols.meta',
'data/handling.meta',
'data/dlctext.meta',
'data/vehiclelayouts.meta',
'data/jmfibpolicegame.dat151.rel',
'data/buffaloacsounds.dat54.rel',
}
data_file 'HANDLING_FILE' 'data/handling.meta'
data_file 'VEHICLE_METADATA_FILE' 'data/vehicles.meta'
data_file 'CARCOLS_FILE' 'data/carcols.meta'
data_file 'VEHICLE_VARIATION_FILE' 'data/carvariations.meta'
data_file 'DLC_TEXT_FILE' 'data/dlctext.meta'
data_file 'VEHICLE_LAYOUTS_FILE' 'data/vehiclelayouts.meta'
data_file 'AUDIO_GAMEDATA' 'data/jmfibpolice_game.dat'
data_file 'AUDIO_SOUNDDATA' 'data/buffaloac_sounds.dat'
client_noscript 'vehicle_names.lua'
https://redd.it/1i1bwb8
@r_lua
fx_version 'cerulean'
game 'gta5'
author 'Jacobmaate'
denoscription 'FIB Police (FIBP) Pack'
version 'v3.03'
files {
'data/vehicles.meta',
'data/carvariations.meta',
'data/carcols.meta',
'data/handling.meta',
'data/dlctext.meta',
'data/vehiclelayouts.meta',
'data/jmfibpolicegame.dat151.rel',
'data/buffaloacsounds.dat54.rel',
}
data_file 'HANDLING_FILE' 'data/handling.meta'
data_file 'VEHICLE_METADATA_FILE' 'data/vehicles.meta'
data_file 'CARCOLS_FILE' 'data/carcols.meta'
data_file 'VEHICLE_VARIATION_FILE' 'data/carvariations.meta'
data_file 'DLC_TEXT_FILE' 'data/dlctext.meta'
data_file 'VEHICLE_LAYOUTS_FILE' 'data/vehiclelayouts.meta'
data_file 'AUDIO_GAMEDATA' 'data/jmfibpolice_game.dat'
data_file 'AUDIO_SOUNDDATA' 'data/buffaloac_sounds.dat'
client_noscript 'vehicle_names.lua'
https://redd.it/1i1bwb8
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Server-side to client-side adaptation
I need to adapt this server-side tool to client-side. I got something with ChatGPT, but it's not what I need.
https://drive.google.com/file/d/1YK0eddB43ZPFNmBUWCQj0LDzyfGkYe12/view?usp=sharing \- Original TAS file.
https://drive.google.com/file/d/1Czn-G6EyZzcohANJuJs9d6oGLSDRypQo/view?usp=sharing \- My TAS file
https://redd.it/1i1iybn
@r_lua
I need to adapt this server-side tool to client-side. I got something with ChatGPT, but it's not what I need.
https://drive.google.com/file/d/1YK0eddB43ZPFNmBUWCQj0LDzyfGkYe12/view?usp=sharing \- Original TAS file.
https://drive.google.com/file/d/1Czn-G6EyZzcohANJuJs9d6oGLSDRypQo/view?usp=sharing \- My TAS file
https://redd.it/1i1iybn
@r_lua
How do i make a lua that downloads from something like discord into a folder?
When i search on google all it gives is download lua
https://redd.it/1i1vvxq
@r_lua
When i search on google all it gives is download lua
https://redd.it/1i1vvxq
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Help rainbow colour Lua how would I write this so it gave me a rainbow colour name tag instead of just one colour been trying for months iv seen other people with it but I can’t figure it out please help 🙏
https://redd.it/1i22nff
@r_lua
https://redd.it/1i22nff
@r_lua
[noob] Replace single space in between non-space characters with wildcard
How to replace a single space (` `) in between non-space characters with `.*`?
I'm writing a simple Lua wrapper (I don't know any programming) to rebuild the string that gets passed to rg (grep alternative) where a single space between non-space characters imply a wildcard. To use a literal space instead of the wildcard), add another space instead (i.e. if the wildcard is not desired and and a literal space is wanted, use 2 spaces to represent a literal space, 3 spaces to represent 2 spaces, etc.).
Example: `a b c d` becomes `a.*b.*c.*d`, `a b c d` becomes `a b.*c.*d`.
I have something like this so far `query:gsub("([^%s])%s([^%s])", "%1.*%2")` but it only results in `a.*b c.*d` (`word word word word` correctly becomes `worda.*wordb.*wordc.*wordd` so I don't understand why) .
-----
For handling literal spaces, I have the following:
local function handle_spaces(str)
str = str:gsub(" +", function(match)
local length = #match
if length > 2 then
return string.rep(" ", length - 1) -- reduce the number of spaces by 1
else
return " " -- for exactly two spaces, return one space
end
end)
return str
end
https://redd.it/1i27mg8
@r_lua
How to replace a single space (` `) in between non-space characters with `.*`?
I'm writing a simple Lua wrapper (I don't know any programming) to rebuild the string that gets passed to rg (grep alternative) where a single space between non-space characters imply a wildcard. To use a literal space instead of the wildcard), add another space instead (i.e. if the wildcard is not desired and and a literal space is wanted, use 2 spaces to represent a literal space, 3 spaces to represent 2 spaces, etc.).
Example: `a b c d` becomes `a.*b.*c.*d`, `a b c d` becomes `a b.*c.*d`.
I have something like this so far `query:gsub("([^%s])%s([^%s])", "%1.*%2")` but it only results in `a.*b c.*d` (`word word word word` correctly becomes `worda.*wordb.*wordc.*wordd` so I don't understand why) .
-----
For handling literal spaces, I have the following:
local function handle_spaces(str)
str = str:gsub(" +", function(match)
local length = #match
if length > 2 then
return string.rep(" ", length - 1) -- reduce the number of spaces by 1
else
return " " -- for exactly two spaces, return one space
end
end)
return str
end
https://redd.it/1i27mg8
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
im a stupid windows user and need help with luarocks
Basically im trying to install the package cjson with luarocks, running the following command:
`luarocks install lua-cjson CC=gcc LD=gcc`
It start compiling normally, but as it reaches cjson.dll it prints this error
gcc -shared -o cjson.dll lua_cjson.o strbuf.o fpconv.o C:/lua/bin/bin/../lib -lmsvcr80
C:/Program Files (x86)/gcc/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find C:\lua\bin\..\lib: Permission denied
collect2.exe: error: ld returned 1 exit status
Error: Build error: Failed installing cjson.dll in C:\lua\bin\bin/../share/luarocks/rocks/lib/luarocks/rocks/lua-cjson/2.1.0.10-1/lib
Im sure the error lies in the LD of gcc, but ive never ran in to this problem. Im confused, can someone help, please?
https://redd.it/1i2am0f
@r_lua
Basically im trying to install the package cjson with luarocks, running the following command:
`luarocks install lua-cjson CC=gcc LD=gcc`
It start compiling normally, but as it reaches cjson.dll it prints this error
gcc -shared -o cjson.dll lua_cjson.o strbuf.o fpconv.o C:/lua/bin/bin/../lib -lmsvcr80
C:/Program Files (x86)/gcc/mingw32/bin/../lib/gcc/i686-w64-mingw32/14.2.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find C:\lua\bin\..\lib: Permission denied
collect2.exe: error: ld returned 1 exit status
Error: Build error: Failed installing cjson.dll in C:\lua\bin\bin/../share/luarocks/rocks/lib/luarocks/rocks/lua-cjson/2.1.0.10-1/lib
Im sure the error lies in the LD of gcc, but ive never ran in to this problem. Im confused, can someone help, please?
https://redd.it/1i2am0f
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Lua beginner tips.
So im starting to learn lua and i have a couple of things i wanna know
First of all can i use it on windows, i tried to install lua on my system couple of times and the system still dont recognise it (help me out in this matter)
Second thing if you have any recomendation to somewhere i can leaen from i would appreciate it (a youtuber or somthing)
https://redd.it/1i2m7y4
@r_lua
So im starting to learn lua and i have a couple of things i wanna know
First of all can i use it on windows, i tried to install lua on my system couple of times and the system still dont recognise it (help me out in this matter)
Second thing if you have any recomendation to somewhere i can leaen from i would appreciate it (a youtuber or somthing)
https://redd.it/1i2m7y4
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Openresty docker compose
How to install any module (Ex: resty.http,...) in docker compse?
https://redd.it/1i2talp
@r_lua
How to install any module (Ex: resty.http,...) in docker compse?
https://redd.it/1i2talp
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Can someone help me adding a cooldown bar connected to an action in a game, in a game/mod noscript?
https://redd.it/1i30wxw
@r_lua
https://redd.it/1i30wxw
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Import module to use in Lua interactive mode question
I am completely new to Lua. I want to use a lib call eff.lua. By following its instruction, I install this lib using
Installing https://luarocks.org/eff-5.0-0.src.rock
eff 5.0-0 is now installed in /home/ubuntu/.luarocks (license: MIT)
However, when attempting to load/ import and use the module in interactive mode after executing the
$ lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> require "eff"
> local Write = inst()
stdin:1: attempt to call global 'inst' (a nil value)
stack traceback:
stdin:1: in main chunk
C: ?
I thought it is because the path problem in the first place. The
How can I fix this error? Thanks.
https://redd.it/1i3bw09
@r_lua
I am completely new to Lua. I want to use a lib call eff.lua. By following its instruction, I install this lib using
$ luarocks --local install eff. It accomplished installation successfully.Installing https://luarocks.org/eff-5.0-0.src.rock
eff 5.0-0 is now installed in /home/ubuntu/.luarocks (license: MIT)
However, when attempting to load/ import and use the module in interactive mode after executing the
lua command, the lua interactive mode displays errors.$ lua
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
> require "eff"
> local Write = inst()
stdin:1: attempt to call global 'inst' (a nil value)
stack traceback:
stdin:1: in main chunk
C: ?
I thought it is because the path problem in the first place. The
require "eff" looks working. So I am confused.How can I fix this error? Thanks.
https://redd.it/1i3bw09
@r_lua
GitHub
GitHub - Nymphium/eff.lua: ONE-SHOT Algebraic Effects for Lua!
ONE-SHOT Algebraic Effects for Lua! Contribute to Nymphium/eff.lua development by creating an account on GitHub.
Improve skills
I want to improve my lua skills help me improve my skills on lua
https://redd.it/1i3cq0q
@r_lua
I want to improve my lua skills help me improve my skills on lua
https://redd.it/1i3cq0q
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Alchemer Lua set url variable or custom variable
This is driving me crazy. Even with an if else statement I cannot figure out how to evaluate two variables and set one of them. Any help is greatly appreciated
This is what I have:
questionID = 111
-- Get the values from the URL and invite
urlval = urlvalue("reg") inviteval = 'invite("custom 5")'
-- Determine which value to use
if urlval ~= nil and urlval ~= ""then
value = urlval
elseif inviteval ~= nil and inviteval ~= "" then
value = inviteval
else
value = nil
-- Set the value for the question
if value ~= nil then setvalue(questionID, value)
end
https://redd.it/1i3fn4q
@r_lua
This is driving me crazy. Even with an if else statement I cannot figure out how to evaluate two variables and set one of them. Any help is greatly appreciated
This is what I have:
questionID = 111
-- Get the values from the URL and invite
urlval = urlvalue("reg") inviteval = 'invite("custom 5")'
-- Determine which value to use
if urlval ~= nil and urlval ~= ""then
value = urlval
elseif inviteval ~= nil and inviteval ~= "" then
value = inviteval
else
value = nil
-- Set the value for the question
if value ~= nil then setvalue(questionID, value)
end
https://redd.it/1i3fn4q
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How to learn Lua
How to learn lua? i wanna learn it for roblox because i wanna make a game and i hope i success with that
if anyone can help i will be appreciated :)
https://redd.it/1i3qizq
@r_lua
How to learn lua? i wanna learn it for roblox because i wanna make a game and i hope i success with that
if anyone can help i will be appreciated :)
https://redd.it/1i3qizq
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Como colocar dierentes consequências em uma mesma condição (if) quando programo em lua?
Olá! Estou fazendo o que posso para aprender a programar usando lua. Nunca programei antes, mas espero que consiga adicionar essa habilidade ao meu portifólio de ferramentas, e quem sabe até fazer um joguinho no roblox com ela.
Enquanto fazia um código para praticar, me deparei com um problema: não consegui escrever várias consequências para um só if. Isso fez com que eu tivesse de extender um parágrafo a três. Isso foi feito para ser assim ou há alguma maneira de fazer em um só parágrafo?
if EFT == true then
HP = HP + 20
elseif TLT == true then
HP = HP + 5
elseif EFT == true if TLT == true then
HP = HP + 25
end
if EFT == true then
TTpoints = 10
elseif TLT == true then
TTpoints = 5
elseif EFT == true and TLT == true then
TTpoints = 10
end
if EFT == true then
XPproductionVR = 2
elseif TLT == true then
XPproductionVR = 8
elseif EFT == true and TLT == true then
XPproductionVR = 4
end
https://redd.it/1i403nr
@r_lua
Olá! Estou fazendo o que posso para aprender a programar usando lua. Nunca programei antes, mas espero que consiga adicionar essa habilidade ao meu portifólio de ferramentas, e quem sabe até fazer um joguinho no roblox com ela.
Enquanto fazia um código para praticar, me deparei com um problema: não consegui escrever várias consequências para um só if. Isso fez com que eu tivesse de extender um parágrafo a três. Isso foi feito para ser assim ou há alguma maneira de fazer em um só parágrafo?
if EFT == true then
HP = HP + 20
elseif TLT == true then
HP = HP + 5
elseif EFT == true if TLT == true then
HP = HP + 25
end
if EFT == true then
TTpoints = 10
elseif TLT == true then
TTpoints = 5
elseif EFT == true and TLT == true then
TTpoints = 10
end
if EFT == true then
XPproductionVR = 2
elseif TLT == true then
XPproductionVR = 8
elseif EFT == true and TLT == true then
XPproductionVR = 4
end
https://redd.it/1i403nr
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How do I call a recursive function multiple times?
```
local pair = function(n)
return n * 2, math.floor(n / 3)
end
local get_id = function(n)
local r = {}
r.rec = function(n)
local a, b = pair(n)
if a == n or b == n then
return "reached" -- I will do stuff here once I figure out the problem
else
tree.rec(a)
tree.rec(b)
end
end
return tree.rec(1)
end
print(get_id(20))
```
I am trying to make a function that will recursively climb up the collatz conjecture tree checking every value for the number I entered "20". Basically, I want this to assign a unique number to every collatz tree number. My problem is that tree.rec(a) is always being called first and tree.rec(b) is never called in the function.
https://redd.it/1i4441m
@r_lua
```
local pair = function(n)
return n * 2, math.floor(n / 3)
end
local get_id = function(n)
local r = {}
r.rec = function(n)
local a, b = pair(n)
if a == n or b == n then
return "reached" -- I will do stuff here once I figure out the problem
else
tree.rec(a)
tree.rec(b)
end
end
return tree.rec(1)
end
print(get_id(20))
```
I am trying to make a function that will recursively climb up the collatz conjecture tree checking every value for the number I entered "20". Basically, I want this to assign a unique number to every collatz tree number. My problem is that tree.rec(a) is always being called first and tree.rec(b) is never called in the function.
https://redd.it/1i4441m
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
OOP "static" functions – terminological confusion?
Hello! I dive into the world of going OOP in Lua.
I understand most about .__index, metatables, prototypes etc.
My question is methodological though about content of certain guides.
Many online guides to OOP (like this one) talk about "static" functions. However, if you have a class
-- Create the table for the class definition
local ExampleClass = {}
ExampleClass.index = ExampleClass
function ExampleClass.new(name)
local self = setmetatable({ name = name }, ExampleClass)
return self
end
function ExampleClass.static()
print("Inside Static Function")
end
function ExampleClass:method()
print(self.name .. "'s method.")
end
-- Prints "Inside Static Function"
ExampleClass.static() -- works as expected
local instance = ExampleClass.new('Named instance')
instance:method()
instance.static() -- unexpected/wrong???
-- Deleting self-referencing class index doesn't help:
ExampleClass.index = nil
ExampleClass.static() -- works as expected
instance.static() -- throws error (good!)
instance:method() -- ALSO throws error (bad!)
The issue here is that static function CAN be accessed from the instance while they shoudn't.
If I understand correctly, this is because "methods" live in class table, which is instance's metatable and referred whenever something is not declared in instance table. This makes it even worse: all the static properties are also accessible from instance. Thank's God they point to the same reference 😳.
Is there an established way to have "true" static functions in Lua? Or is this concept pretty much misused?
I know that Lua's OOP is often most-likely prototype based. But so is e.g. JS where still static is a static:
class Class {
constructor() {
this.prop = "";
}
static staticFunction() {
console.log("static");
}
methodFunction() {
console.log("method");
}
}
let instance = new Class();
Class.staticFunction(); // works
instance.methodFunction(); // works
instance.staticFunction(); // ERROR: not a function
https://redd.it/1i49gwm
@r_lua
Hello! I dive into the world of going OOP in Lua.
I understand most about .__index, metatables, prototypes etc.
My question is methodological though about content of certain guides.
Many online guides to OOP (like this one) talk about "static" functions. However, if you have a class
-- Create the table for the class definition
local ExampleClass = {}
ExampleClass.index = ExampleClass
function ExampleClass.new(name)
local self = setmetatable({ name = name }, ExampleClass)
return self
end
function ExampleClass.static()
print("Inside Static Function")
end
function ExampleClass:method()
print(self.name .. "'s method.")
end
-- Prints "Inside Static Function"
ExampleClass.static() -- works as expected
local instance = ExampleClass.new('Named instance')
instance:method()
instance.static() -- unexpected/wrong???
-- Deleting self-referencing class index doesn't help:
ExampleClass.index = nil
ExampleClass.static() -- works as expected
instance.static() -- throws error (good!)
instance:method() -- ALSO throws error (bad!)
The issue here is that static function CAN be accessed from the instance while they shoudn't.
If I understand correctly, this is because "methods" live in class table, which is instance's metatable and referred whenever something is not declared in instance table. This makes it even worse: all the static properties are also accessible from instance. Thank's God they point to the same reference 😳.
Is there an established way to have "true" static functions in Lua? Or is this concept pretty much misused?
I know that Lua's OOP is often most-likely prototype based. But so is e.g. JS where still static is a static:
class Class {
constructor() {
this.prop = "";
}
static staticFunction() {
console.log("static");
}
methodFunction() {
console.log("method");
}
}
let instance = new Class();
Class.staticFunction(); // works
instance.methodFunction(); // works
instance.staticFunction(); // ERROR: not a function
https://redd.it/1i49gwm
@r_lua
Just started learning - could use some help explaining some things
I have little experience in languages like Python and Java but wanted to learn Lua to make Roblox noscripts along with 2D games. I want to start off by just learning Lua as a whole. I've been learning for the past 3 days now (7 hours coding, and about 2 hours watching videos). Something that I'm struggling to get is the for and repeat loop, along with tables.
for a for loop the only thing I can do/make is:
for i = 1, 10 do
print("Hi.")
end
for tables, I try to make word-guessing games, or guess the length of a word but always have issues calling it from the table
local words = {
"Dog", "Wire", "Mountian", "Tree", "House", "Car", "Bike", "Plane", "Boat",
"Train", "Donkey", "Cat", "Fish", "Bird", "Lion", "Tiger", "Bear", "Wolf", "Fox", "Rabbit", "Horse",
"Cow", "Pig", "Sheep", "Goat", "Chicken", "Duck", "Goose", "Turkey", "Penguin", "Ostrich", "Eagle", "Hawk",
"Falcon", "Owl", "Parrot", "Crow", "Raven", "Seagull", "Dove", "Sparrow", "Robin", "Bluejay", "Cardinal", "Woodpecker",
"Hummingbird", "Swan", "Pelican", "Flamingo", "Stork", "Crane", "Heron", "Ibis", "Vulture", "Condor", "Albatross", "Puffin", "Pigeon", "Starling", "Nigger"
}
io.write("Select a letter: ")
local userLetter = io.read():upper()
local matchingWords = {}
for , word in ipairs(words) do
if word:sub(1, 1) == userLetter then
table.insert(matchingWords, word)
end
end
if #matchingWords > 0 then
print("Words starting with '" .. userLetter .. "':")
for , word in ipairs(matchingWords) do
print(word)
end
else
print("No words found starting with '" .. userLetter .. "'.")
end
https://redd.it/1i4bumn
@r_lua
I have little experience in languages like Python and Java but wanted to learn Lua to make Roblox noscripts along with 2D games. I want to start off by just learning Lua as a whole. I've been learning for the past 3 days now (7 hours coding, and about 2 hours watching videos). Something that I'm struggling to get is the for and repeat loop, along with tables.
for a for loop the only thing I can do/make is:
for i = 1, 10 do
print("Hi.")
end
for tables, I try to make word-guessing games, or guess the length of a word but always have issues calling it from the table
local words = {
"Dog", "Wire", "Mountian", "Tree", "House", "Car", "Bike", "Plane", "Boat",
"Train", "Donkey", "Cat", "Fish", "Bird", "Lion", "Tiger", "Bear", "Wolf", "Fox", "Rabbit", "Horse",
"Cow", "Pig", "Sheep", "Goat", "Chicken", "Duck", "Goose", "Turkey", "Penguin", "Ostrich", "Eagle", "Hawk",
"Falcon", "Owl", "Parrot", "Crow", "Raven", "Seagull", "Dove", "Sparrow", "Robin", "Bluejay", "Cardinal", "Woodpecker",
"Hummingbird", "Swan", "Pelican", "Flamingo", "Stork", "Crane", "Heron", "Ibis", "Vulture", "Condor", "Albatross", "Puffin", "Pigeon", "Starling", "Nigger"
}
io.write("Select a letter: ")
local userLetter = io.read():upper()
local matchingWords = {}
for , word in ipairs(words) do
if word:sub(1, 1) == userLetter then
table.insert(matchingWords, word)
end
end
if #matchingWords > 0 then
print("Words starting with '" .. userLetter .. "':")
for , word in ipairs(matchingWords) do
print(word)
end
else
print("No words found starting with '" .. userLetter .. "'.")
end
https://redd.it/1i4bumn
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community