Data entry for lua
This is probably a basic question but I just can't find a good answer. I'm working on a card game in defold and need to add a bunch of cards. I have some in lua files but adding them all manually is a pain. Is there a tool I can use to write the entries in an actual table and have them come out as lua? Is it just, do it as CSV and find a converter?
https://redd.it/1l46h3q
@r_lua
This is probably a basic question but I just can't find a good answer. I'm working on a card game in defold and need to add a bunch of cards. I have some in lua files but adding them all manually is a pain. Is there a tool I can use to write the entries in an actual table and have them come out as lua? Is it just, do it as CSV and find a converter?
https://redd.it/1l46h3q
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Interest in a Lua based modular game engine written in Rust?
I have an idea and a project I have planned out that is based heavily on modularity and the Lua programming language
For more detail I expect every UI element of the engine to be a "module" (can be written by any user and swapped or replaced and such) for example lets say we have a simple explorer that comes with the engine but is quickly seen to be too simple or lacking features you could either write your own file explorer and replaces its position in UI or download one off the internet and use that instead obviously this is just an example and I plan that other tools separate from the base ones can be created as well
This idea comes from when I was checking out Roblox Studio and saw the potential in the user made extensions where every user can create these UI elements and upload them to be used elsewhere within the engine I think a engine based on this potential would be extremely useful to those with a very unique workflow
https://redd.it/1l49ew7
@r_lua
I have an idea and a project I have planned out that is based heavily on modularity and the Lua programming language
For more detail I expect every UI element of the engine to be a "module" (can be written by any user and swapped or replaced and such) for example lets say we have a simple explorer that comes with the engine but is quickly seen to be too simple or lacking features you could either write your own file explorer and replaces its position in UI or download one off the internet and use that instead obviously this is just an example and I plan that other tools separate from the base ones can be created as well
This idea comes from when I was checking out Roblox Studio and saw the potential in the user made extensions where every user can create these UI elements and upload them to be used elsewhere within the engine I think a engine based on this potential would be extremely useful to those with a very unique workflow
https://redd.it/1l49ew7
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
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