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
Lua ressources for intermediate programmers
Hello,
I am a hobbyist programmer with an background in math and an interest in computer science.
I worked myself through "COMMON LISP: A Gentle Introduction to Symbolic Computation" which was great. The exercises were trickey but also great fun and I learned a lot .
Now I developed an interest in Lua and I am allmost through "Programming in Lua". It is a great book about lua, but not a programming course.
Can you recommand good didactic ressources about programming/computer science on an intermediate to advanced level, that use lua as an prgramming language?
So far I found
\- Lua programming gems
\- https://github.com/a327ex/blog/issues/30
That should keep me busy for a while, but I am wondering, if there are other interesting options.
Thanks in advance!
https://redd.it/1i4f9qy
@r_lua
Hello,
I am a hobbyist programmer with an background in math and an interest in computer science.
I worked myself through "COMMON LISP: A Gentle Introduction to Symbolic Computation" which was great. The exercises were trickey but also great fun and I learned a lot .
Now I developed an interest in Lua and I am allmost through "Programming in Lua". It is a great book about lua, but not a programming course.
Can you recommand good didactic ressources about programming/computer science on an intermediate to advanced level, that use lua as an prgramming language?
So far I found
\- Lua programming gems
\- https://github.com/a327ex/blog/issues/30
That should keep me busy for a while, but I am wondering, if there are other interesting options.
Thanks in advance!
https://redd.it/1i4f9qy
@r_lua
GitHub
BYTEPATH #0 - Introduction · Issue #30 · a327ex/blog
Introduction This tutorial series will cover the creation of a complete game with Lua and LÖVE. It's aimed at programmers who have some experience but are just starting out with game developmen...
What are things lua is missing or needs to change that you'd like to see?
Currently, I'm working on a small project that transpiles a custom version of lua's syntax to original lua. I plan to make an extension for it to use in my projects.
Here's an overview of it. This is what the transpiler sees in terms of types.
https://preview.redd.it/1x36nwz0tsde1.png?width=676&format=png&auto=webp&s=4feae0111a59867c9e896ced735cf700fe4e882f
Let me know, I'll gladly take suggestions! Specially on classes, I'm not sure how built in class would look.
https://redd.it/1i4eeq3
@r_lua
Currently, I'm working on a small project that transpiles a custom version of lua's syntax to original lua. I plan to make an extension for it to use in my projects.
Here's an overview of it. This is what the transpiler sees in terms of types.
https://preview.redd.it/1x36nwz0tsde1.png?width=676&format=png&auto=webp&s=4feae0111a59867c9e896ced735cf700fe4e882f
Let me know, I'll gladly take suggestions! Specially on classes, I'm not sure how built in class would look.
https://redd.it/1i4eeq3
@r_lua
HI im trying to learn lua and im 12
im trying to learn lua and im 12 so do someone knows a free app to learn lua ?
thx !
https://redd.it/1i4iut6
@r_lua
im trying to learn lua and im 12 so do someone knows a free app to learn lua ?
thx !
https://redd.it/1i4iut6
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Terminal don't print anything of my lua code. Where did i go wrong?
Hi! I'm here again. I'm checking my learn on lua making a code. This code verify if talent (TLT) and efforce (EFT) are true, and then change the variables to make then have the same level, hp, and xp, even though they work by different ways. Buut, i guess something is wrong, since terminal don't print nothing. Someone can help me? Thanks for attention :)
HP = 0
XP = 0
LV = 0
EFT = false
TLT = true
TT = 0
if EFT == true then
HP = HP + 20
TTpoints = 10
XPproductionVR = 2
elseif TLT == true then
HP = HP + 5
TTpoints = 5
XPproductionVR = 8
elseif EFT == true and TLT == true then
HP = HP + 25
TTpoints = 10
XPproductionVR = 4
end
function TTproduction()
TT = TT + TTpoints
end
function XPproduction()
XP = TT * XPproductionVR
end
if TLT == true then
LevelUpVR1 = 20
LevelUpVR2 = 40
LevelUpVR3 = 60
elseif EFT == true then
LevelUpVR1 = 40
LevelUpVR2 = 80
LevelUpVR3 = 120
elseif TLT == true and EFT == true then
LevelUpVR1 = 40
LevelUpVR2 = 80
LevelUpVR3 = 120
end
if XP < LevelUpVR1 then
LV = 0
elseif XP >= LevelUpVR1 then
LV = 1
elseif XP >= LevelUpVR2 then
LV = 2
elseif XP == LevelUpVR3 then
LV = 3
end
while LV < 3 do
TTproduction()
XPproduction()
end
if LV == 0 then
HP = 5
elseif LV == 1 then
HP = 10
elseif LV == 2 then
HP = 20
elseif LV == 3 then
HP = 30
end
print(HP, XP, LV)
https://redd.it/1i4hiyk
@r_lua
Hi! I'm here again. I'm checking my learn on lua making a code. This code verify if talent (TLT) and efforce (EFT) are true, and then change the variables to make then have the same level, hp, and xp, even though they work by different ways. Buut, i guess something is wrong, since terminal don't print nothing. Someone can help me? Thanks for attention :)
HP = 0
XP = 0
LV = 0
EFT = false
TLT = true
TT = 0
if EFT == true then
HP = HP + 20
TTpoints = 10
XPproductionVR = 2
elseif TLT == true then
HP = HP + 5
TTpoints = 5
XPproductionVR = 8
elseif EFT == true and TLT == true then
HP = HP + 25
TTpoints = 10
XPproductionVR = 4
end
function TTproduction()
TT = TT + TTpoints
end
function XPproduction()
XP = TT * XPproductionVR
end
if TLT == true then
LevelUpVR1 = 20
LevelUpVR2 = 40
LevelUpVR3 = 60
elseif EFT == true then
LevelUpVR1 = 40
LevelUpVR2 = 80
LevelUpVR3 = 120
elseif TLT == true and EFT == true then
LevelUpVR1 = 40
LevelUpVR2 = 80
LevelUpVR3 = 120
end
if XP < LevelUpVR1 then
LV = 0
elseif XP >= LevelUpVR1 then
LV = 1
elseif XP >= LevelUpVR2 then
LV = 2
elseif XP == LevelUpVR3 then
LV = 3
end
while LV < 3 do
TTproduction()
XPproduction()
end
if LV == 0 then
HP = 5
elseif LV == 1 then
HP = 10
elseif LV == 2 then
HP = 20
elseif LV == 3 then
HP = 30
end
print(HP, XP, LV)
https://redd.it/1i4hiyk
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Can someone please help me with my noscript?
I made a noscript for a game with chatgpt, it's basically 3 noscripts in one.
1-Caps Lock + Right Mouse Button + Left Mouse Button Rapid-Fire: This functionality is only activated when Caps Lock is on. It allows for rapid clicking when the right mouse button is held and the left mouse button is also held.
2-Right Mouse Button Toggles Right Shift: This noscript presses the Right Shift key when the right mouse button is pressed and releases it when the right mouse button is released. It operates independently of the other noscript's conditions.
3-Mouse Button Interactions: It handles mouse movements when the right mouse button is held, and the left mouse button is also held.
The issue is that when I press capslock so number 1 can work, the other two functions stop working. I need nr2 and 3 to always be active, but as soon as I turn on capslock for the rapid fire then only rapid fire works.
Here is the noscript but pasting it here messes up the formatting for some reason so here is also a screenshot how it looks like in the logitech ghub software: https://i.imgur.com/PiiaGfB.png
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
-- First Script: Caps Lock + Right Mouse Button + Left Mouse Button Rapid-Fire
if IsKeyLockOn("capslock") then -- Check if Caps Lock is enabled
if IsMouseButtonPressed(3) then -- If the right mouse button is held
repeat
if IsMouseButtonPressed(1) then -- If the left mouse button is held
repeat
PressMouseButton(1) -- Press left mouse button
Sleep(50) -- Speed of rapid-fire, adjust as needed
ReleaseMouseButton(1) -- Immediately release after pressing
until not IsMouseButtonPressed(1) -- Stop when left mouse button is released
end
until not IsMouseButtonPressed(3) -- Stop when the right mouse button is released
end
end
-- Second Script: Right Mouse Button toggles Right Shift (always active)
if event == "MOUSEBUTTONPRESSED" and arg == 2 then -- Right mouse button
PressKey("RSHIFT") -- Press Right Shift
return -- Exit here to avoid interference
elseif event == "MOUSEBUTTONRELEASED" and arg == 2 then
ReleaseKey("RSHIFT") -- Release Right Shift
return -- Exit here to avoid interference
end
-- Second Script: Mouse button interactions (always active)
if IsMouseButtonPressed(3) then
repeat
if IsMouseButtonPressed(1) then
repeat
MoveMouseRelative(0, 2)
Sleep(90)
until not IsMouseButtonPressed(1)
end
until not IsMouseButtonPressed(3)
end
end
Really hope someone can help me with this because chatgpt is messing it up.
https://redd.it/1i5zjpp
@r_lua
I made a noscript for a game with chatgpt, it's basically 3 noscripts in one.
1-Caps Lock + Right Mouse Button + Left Mouse Button Rapid-Fire: This functionality is only activated when Caps Lock is on. It allows for rapid clicking when the right mouse button is held and the left mouse button is also held.
2-Right Mouse Button Toggles Right Shift: This noscript presses the Right Shift key when the right mouse button is pressed and releases it when the right mouse button is released. It operates independently of the other noscript's conditions.
3-Mouse Button Interactions: It handles mouse movements when the right mouse button is held, and the left mouse button is also held.
The issue is that when I press capslock so number 1 can work, the other two functions stop working. I need nr2 and 3 to always be active, but as soon as I turn on capslock for the rapid fire then only rapid fire works.
Here is the noscript but pasting it here messes up the formatting for some reason so here is also a screenshot how it looks like in the logitech ghub software: https://i.imgur.com/PiiaGfB.png
EnablePrimaryMouseButtonEvents(true)
function OnEvent(event, arg)
-- First Script: Caps Lock + Right Mouse Button + Left Mouse Button Rapid-Fire
if IsKeyLockOn("capslock") then -- Check if Caps Lock is enabled
if IsMouseButtonPressed(3) then -- If the right mouse button is held
repeat
if IsMouseButtonPressed(1) then -- If the left mouse button is held
repeat
PressMouseButton(1) -- Press left mouse button
Sleep(50) -- Speed of rapid-fire, adjust as needed
ReleaseMouseButton(1) -- Immediately release after pressing
until not IsMouseButtonPressed(1) -- Stop when left mouse button is released
end
until not IsMouseButtonPressed(3) -- Stop when the right mouse button is released
end
end
-- Second Script: Right Mouse Button toggles Right Shift (always active)
if event == "MOUSEBUTTONPRESSED" and arg == 2 then -- Right mouse button
PressKey("RSHIFT") -- Press Right Shift
return -- Exit here to avoid interference
elseif event == "MOUSEBUTTONRELEASED" and arg == 2 then
ReleaseKey("RSHIFT") -- Release Right Shift
return -- Exit here to avoid interference
end
-- Second Script: Mouse button interactions (always active)
if IsMouseButtonPressed(3) then
repeat
if IsMouseButtonPressed(1) then
repeat
MoveMouseRelative(0, 2)
Sleep(90)
until not IsMouseButtonPressed(1)
end
until not IsMouseButtonPressed(3)
end
end
Really hope someone can help me with this because chatgpt is messing it up.
https://redd.it/1i5zjpp
@r_lua
Imgur
Discover the magic of the internet at Imgur, a community powered entertainment destination. Lift your spirits with funny jokes, trending memes, entertaining gifs, inspiring stories, viral videos, and so much more from users.
Logitech G hub noscript help
is something wrong with this code? I want it to print Hello when mouse 5 is pressed but nothing seems to happen in the console?
https://redd.it/1i60hor
@r_lua
function OnEvent(event, arg)if event == "MOUSE_BUTTON_PRESSED" and arg == 5 thenprint("Hello")endendis something wrong with this code? I want it to print Hello when mouse 5 is pressed but nothing seems to happen in the console?
https://redd.it/1i60hor
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Made a Tutorial to Learn Lua Quickly
https://www.youtube.com/watch?v=ZvfERGBI3Io
https://redd.it/1i7bxs8
@r_lua
https://www.youtube.com/watch?v=ZvfERGBI3Io
https://redd.it/1i7bxs8
@r_lua
YouTube
Learn Lua in Under 20 minutes (Lua Tutorial)
A quick tutorial to learn quite a lot of the basics of Lua. By the end of this tutorial you will comfortably be able to follow any tutorial that requires Lua like Roblox, Love2d, Codea, and more or just code in Lua.
0:00 Introduction
0:13 Printing
0:36 Variables…
0:00 Introduction
0:13 Printing
0:36 Variables…
How to write code to add a specific number to an existing value
This might be a very basic query, but I've gotta learn somehow. So let's say I have an address with a value of 1000, which in hex is 3E8. And I want to add 200 to it, which would be C8. Is it possible to write code that makes that happen? Something like :
BlobHP = 0x8086963
If ReadShort BlobGainsItem
add (C8) to BlobHP.
That probably hurt to read if you're actually good at this and I wouldn't actually write it like that, but I'm just trying to get the idea of what I mean across. Pls help if you know how.
https://redd.it/1i87v0k
@r_lua
This might be a very basic query, but I've gotta learn somehow. So let's say I have an address with a value of 1000, which in hex is 3E8. And I want to add 200 to it, which would be C8. Is it possible to write code that makes that happen? Something like :
BlobHP = 0x8086963
If ReadShort BlobGainsItem
add (C8) to BlobHP.
That probably hurt to read if you're actually good at this and I wouldn't actually write it like that, but I'm just trying to get the idea of what I mean across. Pls help if you know how.
https://redd.it/1i87v0k
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
darwin first beta: 0.017 released,the most advanced lua compiler
https://github.com/OUIsolutions/Darwin
https://redd.it/1i8egzo
@r_lua
https://github.com/OUIsolutions/Darwin
https://redd.it/1i8egzo
@r_lua
GitHub
GitHub - OUIsolutions/Darwin: A Boostrapped lua Compiler
A Boostrapped lua Compiler. Contribute to OUIsolutions/Darwin development by creating an account on GitHub.
question from complete beginner about for loops
https://preview.redd.it/lf9ecc7rutee1.png?width=1920&format=png&auto=webp&s=335377fa473beea58aca5a3ce37b0ed19a59d5e9
hi, i am a complete beginner in both lua and programming in general. i was just wondering if there is a way to make a variable using for loops (as you can see i'm repeating the same loop multiple times)
sorry if this has been asked before, i didn't really know what to search for on google for my question, thanks!
https://redd.it/1i8hanw
@r_lua
https://preview.redd.it/lf9ecc7rutee1.png?width=1920&format=png&auto=webp&s=335377fa473beea58aca5a3ce37b0ed19a59d5e9
hi, i am a complete beginner in both lua and programming in general. i was just wondering if there is a way to make a variable using for loops (as you can see i'm repeating the same loop multiple times)
sorry if this has been asked before, i didn't really know what to search for on google for my question, thanks!
https://redd.it/1i8hanw
@r_lua
Matching markdown tables (regex)
I have a Lua noscript that parses MediaWiki markdown tables. It works great for "flat" tables where the elements in a row are all inline and separated with double pipes, but I'm having trouble making a separate noscript to deal with tables with each field on a different line such as this:
|-
| Game ABC
|{{untested}} <!-- xefu -->
|{{untested}} <!-- xefu2 -->
|{{untested}} <!-- xefu3 -->
|{{untested}} <!-- xefu5 -->
|{{untested}} <!-- xefu11 -->
|{{untested}} <!-- xefu6 -->
|{{playable}} <!-- xefu7 -->
|{{untested}} <!-- xefu7b -->
|{{untested}} <!-- xefu2019 -->
|{{untested}} <!-- xefu2021a -->
|{{untested}} <!-- xefu2021b -->
|{{untested}} <!-- xefu2021c -->
| Name Here
| Notes Here
|-
| Another Game
|{{menus}} <!-- xefu -->
|{{untested}} <!-- xefu2 -->
|{{menus}} <!-- xefu3 -->
|{{untested}} <!-- xefu5 -->
|{{untested}} <!-- xefu11 -->
|{{menus}} <!-- xefu6 -->
|{{menus}} <!-- xefu7 -->
|{{menus}} <!-- xefu7b -->
|{{untested}} <!-- xefu2019 -->
|{{untested}} <!-- xefu2021a -->
|{{untested}} <!-- xefu2021b -->
|{{untested}} <!-- xefu2021c -->
| Names Here
| Notes Here
|-
I'm interested in taking the info between two different
I feel like I'm close, but having trouble since Lua doesn't seem to support lookahead or non-capture groups:
for row in wikitable:gmatch("|%-(.-)|%-") do
https://redd.it/1i9gn5f
@r_lua
I have a Lua noscript that parses MediaWiki markdown tables. It works great for "flat" tables where the elements in a row are all inline and separated with double pipes, but I'm having trouble making a separate noscript to deal with tables with each field on a different line such as this:
|-
| Game ABC
|{{untested}} <!-- xefu -->
|{{untested}} <!-- xefu2 -->
|{{untested}} <!-- xefu3 -->
|{{untested}} <!-- xefu5 -->
|{{untested}} <!-- xefu11 -->
|{{untested}} <!-- xefu6 -->
|{{playable}} <!-- xefu7 -->
|{{untested}} <!-- xefu7b -->
|{{untested}} <!-- xefu2019 -->
|{{untested}} <!-- xefu2021a -->
|{{untested}} <!-- xefu2021b -->
|{{untested}} <!-- xefu2021c -->
| Name Here
| Notes Here
|-
| Another Game
|{{menus}} <!-- xefu -->
|{{untested}} <!-- xefu2 -->
|{{menus}} <!-- xefu3 -->
|{{untested}} <!-- xefu5 -->
|{{untested}} <!-- xefu11 -->
|{{menus}} <!-- xefu6 -->
|{{menus}} <!-- xefu7 -->
|{{menus}} <!-- xefu7b -->
|{{untested}} <!-- xefu2019 -->
|{{untested}} <!-- xefu2021a -->
|{{untested}} <!-- xefu2021b -->
|{{untested}} <!-- xefu2021c -->
| Names Here
| Notes Here
|-
I'm interested in taking the info between two different
|- as one entry.I feel like I'm close, but having trouble since Lua doesn't seem to support lookahead or non-capture groups:
for row in wikitable:gmatch("|%-(.-)|%-") do
https://redd.it/1i9gn5f
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Lua Powered Remote Garage Door Controller
This Lua-powered DIY DoorController project provides a web-based solution for controlling a garage door remotely. It includes a minimally invasive design with a magnetic reed switch for detecting door states and an NPN transistor for simulating button presses on a generic garage door remote. The software provides a web interface that can be added to mobile home screens for app-like functionality. The project also supports email garage door open/close state logging by configuring SMTP settings.
Project link: https://github.com/jjsch-dev/DoorController
https://redd.it/1i9ujlv
@r_lua
This Lua-powered DIY DoorController project provides a web-based solution for controlling a garage door remotely. It includes a minimally invasive design with a magnetic reed switch for detecting door states and an NPN transistor for simulating button presses on a generic garage door remote. The software provides a web interface that can be added to mobile home screens for app-like functionality. The project also supports email garage door open/close state logging by configuring SMTP settings.
Project link: https://github.com/jjsch-dev/DoorController
https://redd.it/1i9ujlv
@r_lua
GitHub
GitHub - jjsch-dev/DoorController
Contribute to jjsch-dev/DoorController development by creating an account on GitHub.
how to install luarocks on windows
I have done it before with the use of this installer, but I want to do it manually so I can customize stuff. The installer works, but it creates problems with my C++ installation.
Few requirements for the install:
Must be on a different hard drive with the packages also on that drive
Must not come with lua install as well. I want to use one I already have installed
Must like work or whatever
so how can i install it?
(also side note does it work with luau?)
https://redd.it/1i9tqxt
@r_lua
I have done it before with the use of this installer, but I want to do it manually so I can customize stuff. The installer works, but it creates problems with my C++ installation.
Few requirements for the install:
Must be on a different hard drive with the packages also on that drive
Must not come with lua install as well. I want to use one I already have installed
Must like work or whatever
so how can i install it?
(also side note does it work with luau?)
https://redd.it/1i9tqxt
@r_lua
GitHub
GitHub - justdie386/theinstaller: The ultimate lua and luarocks installer, which includes the mingw toolchain, to make this a truly…
The ultimate lua and luarocks installer, which includes the mingw toolchain, to make this a truly working out of the box experience - justdie386/theinstaller