Edificio Sencillo en Luanti Minetest - NO MINECRAFT
https://youtu.be/bGEGQ0irZbw?si=BpUC2bepwt_nwxGF
https://redd.it/1l52kda
@r_lua
https://youtu.be/bGEGQ0irZbw?si=BpUC2bepwt_nwxGF
https://redd.it/1l52kda
@r_lua
YouTube
Edificio Sencillo en Luanti Minetest - NO MINECRAFT
Edificio hecho en Luanti-Minetest, No Minecraft
Where can i learn lua for free?
Lua is my first programming language. I've been learning it for six months, ever since I found a YouTube channel that teaches it for free. After watching their videos, I learned the basics of the language, but now I want to improve my knowledge and skills.
Where can I find more free Lua content? And what tips would you give me, knowing that I already understand the basic functions?
https://redd.it/1l63gim
@r_lua
Lua is my first programming language. I've been learning it for six months, ever since I found a YouTube channel that teaches it for free. After watching their videos, I learned the basics of the language, but now I want to improve my knowledge and skills.
Where can I find more free Lua content? And what tips would you give me, knowing that I already understand the basic functions?
https://redd.it/1l63gim
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
can someone create a game engine 3d and 2d like unity interface not exactly the same but in lua please i beg u
please.
https://redd.it/1l63kw6
@r_lua
please.
https://redd.it/1l63kw6
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How can I add a simple kill switch which can prevent my obfuscated noscripts posted on the internet from executing after i "disable" them in ant way?
https://redd.it/1l6h6n1
@r_lua
https://redd.it/1l6h6n1
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Can someone check this course and give me feedback about it as starting course for lua, and getting into it syntext
https://github.com/Bayt-al-Hikmah/Lua/
https://redd.it/1l76ja0
@r_lua
https://github.com/Bayt-al-Hikmah/Lua/
https://redd.it/1l76ja0
@r_lua
GitHub
GitHub - Bayt-al-Hikmah/Lua: Introduction to Lua Programming using
Introduction to Lua Programming using . Contribute to Bayt-al-Hikmah/Lua development by creating an account on GitHub.
Creating an object by reference
I'm sure there's a better way to phrase the noscript, but that's what i came up with. Here's my issue: I have multiple tables and other objects that have a property that needs to be changed based on some condition. But I'm unable to get any of the tables to get the updated value.
Sample code illustrating this:
The output of the above is:
But I am expecting to get:
How can I achieve this behaviour? And please don't suggest updating all objects manually every time the variable changes. That rather defeats the entire purpose of a variable.
https://redd.it/1l7d8cj
@r_lua
I'm sure there's a better way to phrase the noscript, but that's what i came up with. Here's my issue: I have multiple tables and other objects that have a property that needs to be changed based on some condition. But I'm unable to get any of the tables to get the updated value.
Sample code illustrating this:
TestVariable = 123
TestObject =
{
['VarToChange'] = TestVariable,
['SomethingStatic'] = 789
}
print (TestObject.VarToChange)
TestVariable = 456
print (TestObject.VarToChange)
The output of the above is:
123
123
But I am expecting to get:
123
456
How can I achieve this behaviour? And please don't suggest updating all objects manually every time the variable changes. That rather defeats the entire purpose of a variable.
https://redd.it/1l7d8cj
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Lua: message dispatching API design for the engine
I am making a Lua API for the engine and wonder how messaging (noscripts can exchange messages by the engine design) API should be exposed.
In C#, it would look like this:
...
class SomeEvent {
public int value;
}
...
Subscribe<SomeEvent>(msg => {
var s = msg.value;
});
...
Dispatcher.Send(new SomeEvent {value = "42"});
...
How should this look in Lua?
The most canonical version seems to be:
...
SomeEvent = {}
SomeEvent.index = SomeEvent
...
subscribe(SomeEvent, function(msg)
local s = msg.value
end)
...
dispatcher:send(setmetatable({value = "42"}, SomeEvent))
...
And its runtime implementation on the binding side is quite convenient.
However, I have two concerns:
1. Assigning the metatable to each message seems boilerplate-heavy. Even if it's moved to the "constructor," it doesn't help much, as many messages will still be created only in a few places.
Moreover, it's unlikely that messages will have any methods, so using metatables doesn't seem very appropriate.
1. To describe engine types and methods, I used Lua Annotations (https://luals.github.io/wiki/annotations/), which is extremely convenient for simulating OOP, allowing the IDE to correctly suggest methods and types, as well as enabling almost complete static analysis of the game code if rules are followed. However, the constructs in the "canonical" style above don't fit into Lua Annotations without boilerplate.
Here's how it looks:
---@generic T
---@param classid `T`
---@param callback fun(msg: T)
function Subscribe(classid, callback)
end
---@param m any
function Send(m)
end
---@class SomeEvent
---@field value string
SomeEvent = {}
SomeEvent.index = SomeEvent
Subscribe('SomeEvent', function (msg)
local s = msg.value
end)
--- Here "value" is outside the IDE analysis
Send(setmetatable({ value = "42"}, SomeEvent))
--- But this works fine, although it's more boilerplate
local a = setmetatable({}, SomeEvent)
a.value = "42"
Send(a)
--- The constructor makes usage cleaner when sending, but sending the same type of message will only happen in a few places. This makes the constructor unnecessary boilerplate.
---@param value string
---@return SomeEvent
function SomeEvent:new(value)
local a = setmetatable({}, SomeEvent)
a.value = value
return a
end
Send(SomeEvent:new("42"))
In general, I see the message system design without crossing into the type system. As boilerplate-free as possible, but support for IDE message dispatching is lost.
SomeEventId = ...
...
subscribe(SomeEventId, function(m)
local s = m.value
end)
...
dispatcher:send(SomeEventId, { value = "42"})
...
Or even this (easier to integrate with the current engine integration code than the previous example):
SomeEventId = ...
...
subscribe({type = SomeEventId }, function(m)
local s = m.value
end)
...
dispatcher:send({type = SomeEventId, value = "42"})
...
Do we even need to pursue type support in the IDE? Or is it enough to just provide suggestions for the engine API itself, and forget about IDE assistance in user code, since Lua programmers generally don't care about such things?
What do you recommend?
https://redd.it/1l7tdmn
@r_lua
I am making a Lua API for the engine and wonder how messaging (noscripts can exchange messages by the engine design) API should be exposed.
In C#, it would look like this:
...
class SomeEvent {
public int value;
}
...
Subscribe<SomeEvent>(msg => {
var s = msg.value;
});
...
Dispatcher.Send(new SomeEvent {value = "42"});
...
How should this look in Lua?
The most canonical version seems to be:
...
SomeEvent = {}
SomeEvent.index = SomeEvent
...
subscribe(SomeEvent, function(msg)
local s = msg.value
end)
...
dispatcher:send(setmetatable({value = "42"}, SomeEvent))
...
And its runtime implementation on the binding side is quite convenient.
However, I have two concerns:
1. Assigning the metatable to each message seems boilerplate-heavy. Even if it's moved to the "constructor," it doesn't help much, as many messages will still be created only in a few places.
Moreover, it's unlikely that messages will have any methods, so using metatables doesn't seem very appropriate.
1. To describe engine types and methods, I used Lua Annotations (https://luals.github.io/wiki/annotations/), which is extremely convenient for simulating OOP, allowing the IDE to correctly suggest methods and types, as well as enabling almost complete static analysis of the game code if rules are followed. However, the constructs in the "canonical" style above don't fit into Lua Annotations without boilerplate.
Here's how it looks:
---@generic T
---@param classid `T`
---@param callback fun(msg: T)
function Subscribe(classid, callback)
end
---@param m any
function Send(m)
end
---@class SomeEvent
---@field value string
SomeEvent = {}
SomeEvent.index = SomeEvent
Subscribe('SomeEvent', function (msg)
local s = msg.value
end)
--- Here "value" is outside the IDE analysis
Send(setmetatable({ value = "42"}, SomeEvent))
--- But this works fine, although it's more boilerplate
local a = setmetatable({}, SomeEvent)
a.value = "42"
Send(a)
--- The constructor makes usage cleaner when sending, but sending the same type of message will only happen in a few places. This makes the constructor unnecessary boilerplate.
---@param value string
---@return SomeEvent
function SomeEvent:new(value)
local a = setmetatable({}, SomeEvent)
a.value = value
return a
end
Send(SomeEvent:new("42"))
In general, I see the message system design without crossing into the type system. As boilerplate-free as possible, but support for IDE message dispatching is lost.
SomeEventId = ...
...
subscribe(SomeEventId, function(m)
local s = m.value
end)
...
dispatcher:send(SomeEventId, { value = "42"})
...
Or even this (easier to integrate with the current engine integration code than the previous example):
SomeEventId = ...
...
subscribe({type = SomeEventId }, function(m)
local s = m.value
end)
...
dispatcher:send({type = SomeEventId, value = "42"})
...
Do we even need to pursue type support in the IDE? Or is it enough to just provide suggestions for the engine API itself, and forget about IDE assistance in user code, since Lua programmers generally don't care about such things?
What do you recommend?
https://redd.it/1l7tdmn
@r_lua
luals.github.io
Lua Language Server | Wiki
Lua Language Server uses the Language Server Protocol to offer a better Lua development experience for your favourite editors.
no, the moon (a love letter to lua)
https://if-not-nil.github.io/no-the-moon/
https://redd.it/1l8zjh9
@r_lua
https://if-not-nil.github.io/no-the-moon/
https://redd.it/1l8zjh9
@r_lua
if-not-nil.github.io
no, the moon | if err != nil
a love letter to lua
What is this error?
Error
library/sti/init.lua:94: STI does not support external Tilesets.
You need to embed all Tilesets.
Traceback
[love "callbacks.lua"\]:228: in function 'handler'
[C\]: in function 'assert'
library/sti/init.lua:94: in function 'init'
library/sti/init.lua:49: in function 'sti'
main.lua:12: in function 'load'
[love "callbacks.lua"\]:136: in function <[love "callbacks.lua"\]:135>
[C\]: in function 'xpcall'
[C\]: in function 'xpcall'
https://redd.it/1l9b0dx
@r_lua
Error
library/sti/init.lua:94: STI does not support external Tilesets.
You need to embed all Tilesets.
Traceback
[love "callbacks.lua"\]:228: in function 'handler'
[C\]: in function 'assert'
library/sti/init.lua:94: in function 'init'
library/sti/init.lua:49: in function 'sti'
main.lua:12: in function 'load'
[love "callbacks.lua"\]:136: in function <[love "callbacks.lua"\]:135>
[C\]: in function 'xpcall'
[C\]: in function 'xpcall'
https://redd.it/1l9b0dx
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
should i learn lua ?
hello there , is it a good idea to start learning lua knowing only python?
https://redd.it/1l9it6j
@r_lua
hello there , is it a good idea to start learning lua knowing only python?
https://redd.it/1l9it6j
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How do I see what I'm doing? (Coordinates)
No matter who I ask or what I search I get something totally irrelevant or literally nothing I need to write some screen coords but i can't see it so i have to make a wild guess to save close run guess again and just hope I find the right thing
https://redd.it/1l9wufx
@r_lua
No matter who I ask or what I search I get something totally irrelevant or literally nothing I need to write some screen coords but i can't see it so i have to make a wild guess to save close run guess again and just hope I find the right thing
https://redd.it/1l9wufx
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
What and is there a difference between the following?
I am learning lua for love2d, and I am wondering if and if so, what the difference is between writing:
Thank you for your time.
https://redd.it/1lc30tb
@r_lua
I am learning lua for love2d, and I am wondering if and if so, what the difference is between writing:
setmetatable(b, a),a.index = b, anda = b:new(<params>).Thank you for your time.
https://redd.it/1lc30tb
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Need help rotating one object to look at another object
I have two objects in 3D space, I need a way to find a quaternion to point one objects -Z face towards another.
Each object is represented by a 'Transform' with X, Y and Z information. They also have Vector3 and Quaternion rotation.
The function that I am using to rotate the objects uses Quaternions, so I need it in that format.
I have tried looking elsewhere, but have found nothing that uses Quaternions for this purpose.
For additional context:
This code is part of a modification for the game "Teardown"
There is a function in "Teardown" called "QuatLookAt". this function doesn't work for my purposes since it always expects to be upright
My noscript is a global noscript that pulls transforms from vehicles. this means that the noscripts orientation is different to the orientation of the objects its modifying.
Thus, when the vehicle flips its vertical orientation is the opposite of what the function expects, causing it to break.
Thank you for any help
https://redd.it/1lc9of8
@r_lua
I have two objects in 3D space, I need a way to find a quaternion to point one objects -Z face towards another.
Each object is represented by a 'Transform' with X, Y and Z information. They also have Vector3 and Quaternion rotation.
The function that I am using to rotate the objects uses Quaternions, so I need it in that format.
I have tried looking elsewhere, but have found nothing that uses Quaternions for this purpose.
For additional context:
This code is part of a modification for the game "Teardown"
There is a function in "Teardown" called "QuatLookAt". this function doesn't work for my purposes since it always expects to be upright
My noscript is a global noscript that pulls transforms from vehicles. this means that the noscripts orientation is different to the orientation of the objects its modifying.
Thus, when the vehicle flips its vertical orientation is the opposite of what the function expects, causing it to break.
Thank you for any help
https://redd.it/1lc9of8
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How to make a lua noscript that activates a key when two other keys are pressed?
I've spent like 5 hours trying to do this and I think I'm out of ideas someone please help.
I'm just trying to make a lua noscript for G Hub where if I hold down right click and my side button then my dpi will go down and then return if one of the buttons is released.
I found this noscript and was trying to add a second button into it but I couldn't get it to work:
function OnEvent(event, gkey, family)
if event == "MOUSEBUTTONPRESSED" and gkey == 2 then
PlayMacro("DPI Down")
elseif event == "MOUSEBUTTONRELEASED" and gkey == 2 then
PlayMacro("DPI Up")
end
end
This noscript works but it only works for the one button - I want to press two mouse buttons to activate the DPI change.
https://redd.it/1lco88w
@r_lua
I've spent like 5 hours trying to do this and I think I'm out of ideas someone please help.
I'm just trying to make a lua noscript for G Hub where if I hold down right click and my side button then my dpi will go down and then return if one of the buttons is released.
I found this noscript and was trying to add a second button into it but I couldn't get it to work:
function OnEvent(event, gkey, family)
if event == "MOUSEBUTTONPRESSED" and gkey == 2 then
PlayMacro("DPI Down")
elseif event == "MOUSEBUTTONRELEASED" and gkey == 2 then
PlayMacro("DPI Up")
end
end
This noscript works but it only works for the one button - I want to press two mouse buttons to activate the DPI change.
https://redd.it/1lco88w
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Yet Another Lua5.1 UTF8 library
I was writing a parser and found all the UTF8 support libraries for Lua are not up to my very high standards /hj. Sooo... I made my own. https://gitlab.com/cinntoast/lutf8
It's on the larger side after compilation because it includes the whole utf8proc database inside of it, but that's a trade off. For now it's just for iterating and identifying unicode codepoints, but I plan to add the utf8 regex capabilities in the few coming days.
Features (and plans):
\- Identifying properties of codepoints (implemented)
\- Validating utf8 sequences (implemented)
\- Mapping/Casefolding/Decomposing/etc sequences (implemented)
\- Bitwise options for lua5.3+ (implemented)
\- Meta file included for people using sumneko language server (wip)
\- POSIX Regex Patterns (planned)
Note: It's still largely untested, and a WIP
https://redd.it/1ldy89z
@r_lua
I was writing a parser and found all the UTF8 support libraries for Lua are not up to my very high standards /hj. Sooo... I made my own. https://gitlab.com/cinntoast/lutf8
It's on the larger side after compilation because it includes the whole utf8proc database inside of it, but that's a trade off. For now it's just for iterating and identifying unicode codepoints, but I plan to add the utf8 regex capabilities in the few coming days.
Features (and plans):
\- Identifying properties of codepoints (implemented)
\- Validating utf8 sequences (implemented)
\- Mapping/Casefolding/Decomposing/etc sequences (implemented)
\- Bitwise options for lua5.3+ (implemented)
\- Meta file included for people using sumneko language server (wip)
\- POSIX Regex Patterns (planned)
Note: It's still largely untested, and a WIP
https://redd.it/1ldy89z
@r_lua
GitLab
Cinnamon / lutf8 · GitLab