Can one determine total gc memory allocated?
If I understand correctly,
https://redd.it/1hh09uz
@r_lua
If I understand correctly,
collectgarbage 'count' gives the amount of allocated memory at the time of invocation. Is there a way in standard Lua/LuaJIT to determine the total memory including that previously collected at the time of invocation? That is, is there a way without modifying Lua itself to determine/benchmark how allocation heavy a piece of code is over a particular run? I'm thinking of something like get-bytes-consed from the SBCL Lisp implementation. Something similar to *gc-run-time* might be nice too.https://redd.it/1hh09uz
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
My lua noscripts do not work when I launch r6 through steam but when I load up a different account through Ubisoft they work can somone help me get them working for stream?
My lua noscripts do not work when I launch r6 through steam but when I load up a different account through Ubisoft they work can somone help me get them working for stream?
https://redd.it/1hh2yvd
@r_lua
My lua noscripts do not work when I launch r6 through steam but when I load up a different account through Ubisoft they work can somone help me get them working for stream?
https://redd.it/1hh2yvd
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How do i make a configuration file that a lua reads from?
Hi, i want to make my lua noscript read from a .cfg or a .txt or whatever format is the easiest to toggle things inside it's menu
The code for what controls the checkboxes, sliders, dropboxes looks like this:
What i want is to have somewhere my lua reads from to see what to toggle on and off as a configuration file for the lua noscript, how can i do this, hopefully i gave enough information for people to help me, if not please let me know
https://redd.it/1hi0ur0
@r_lua
Hi, i want to make my lua noscript read from a .cfg or a .txt or whatever format is the easiest to toggle things inside it's menu
The code for what controls the checkboxes, sliders, dropboxes looks like this:
local Controls = { checkbox1 = false, checkbox2 = false, checkbox3 = false, checkbox4= true, Dropdown1 = 1, Dropdown2 = 1, Slider1 = 90, Slider1Input = "", Slider1Editing = false, } What i want is to have somewhere my lua reads from to see what to toggle on and off as a configuration file for the lua noscript, how can i do this, hopefully i gave enough information for people to help me, if not please let me know
https://redd.it/1hi0ur0
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
hello
https://preview.redd.it/wbn7acdk308e1.png?width=844&format=png&auto=webp&s=d4e48660728fd31ad8b66574865957f04e389313
Hello, I have a problem with the Fivem server because on the paid hosting the noscript package does not work, but on the free one it already works and I keep getting the following error
https://redd.it/1hij6m2
@r_lua
https://preview.redd.it/wbn7acdk308e1.png?width=844&format=png&auto=webp&s=d4e48660728fd31ad8b66574865957f04e389313
Hello, I have a problem with the Fivem server because on the paid hosting the noscript package does not work, but on the free one it already works and I keep getting the following error
https://redd.it/1hij6m2
@r_lua
Just a Lil help
Could any Lua/Luau master give me some tips on how to improve my programming? I've already learned a lot from some tutorials on YouTube (a lot). My goal is just to learn enough to be able to create a game on Roblox, as a start, of course.
Thx
https://redd.it/1hivu43
@r_lua
Could any Lua/Luau master give me some tips on how to improve my programming? I've already learned a lot from some tutorials on YouTube (a lot). My goal is just to learn enough to be able to create a game on Roblox, as a start, of course.
Thx
https://redd.it/1hivu43
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
LUA state in 2025?
Hello everyone,
2024 is coming to an end and I'm quite curious about this, what is the current state of LUA in 2025? On the website of LUA, I feel like there's not much of an update. When I search LUA 2024 on Google, the result seems to stop at 2023. There are not many discussions, jobs for LUA also seem to be no result too. So I wonder, what is LUA going to be like in 2025?
The question seems to be vague, I hope you can understand as English is not my first language.
https://redd.it/1hj48nl
@r_lua
Hello everyone,
2024 is coming to an end and I'm quite curious about this, what is the current state of LUA in 2025? On the website of LUA, I feel like there's not much of an update. When I search LUA 2024 on Google, the result seems to stop at 2023. There are not many discussions, jobs for LUA also seem to be no result too. So I wonder, what is LUA going to be like in 2025?
The question seems to be vague, I hope you can understand as English is not my first language.
https://redd.it/1hj48nl
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
I want to build a small forum using Lua.
Hello!
I expressed my purpose in the noscript.
What library would you recommend to use?
Something like Python-Flask.
If it has basic support for creating endpoints, requests and templating I am happy.
I heard Lapis is the most mature.
https://redd.it/1hj9f9f
@r_lua
Hello!
I expressed my purpose in the noscript.
What library would you recommend to use?
Something like Python-Flask.
If it has basic support for creating endpoints, requests and templating I am happy.
I heard Lapis is the most mature.
https://redd.it/1hj9f9f
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
What is the best way to give a class “private” members?
Giving a class its members in lua implicitly makes them public.
https://redd.it/1hjou4b
@r_lua
Giving a class its members in lua implicitly makes them public.
https://redd.it/1hjou4b
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Javanoscript "this" function but in lua?
I'm here in roblox getting stuck at this.
Javanoscript has this cool thing here where it is like
function button() {
print(this)
}
And the "this" will show whatever button executed this function, it can be fifty button with that function and it is a cool thing, but what about lua?
Button.TouchSwipe:Connect(function(SwipeDirection, Number, Processed)
print("??")
end)
How the hell do i do it, and roblox lua is a little different than lua right?
https://redd.it/1hk0gvh
@r_lua
I'm here in roblox getting stuck at this.
Javanoscript has this cool thing here where it is like
function button() {
print(this)
}
And the "this" will show whatever button executed this function, it can be fifty button with that function and it is a cool thing, but what about lua?
Button.TouchSwipe:Connect(function(SwipeDirection, Number, Processed)
print("??")
end)
How the hell do i do it, and roblox lua is a little different than lua right?
https://redd.it/1hk0gvh
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Help with inconsistent iterator behavior
I am familiar with the concept of iterators in other languages, but I can't figure out how to get normal iterator behavior out of lua tables. The top example works normally with string iterators, but the bottom does not with table iterators.
-- works
stringEntries = string.gmatch("text1,text2,text3", "(^,+)")
print(stringEntries)
-- function: 0x5627c89b62c0
print(stringEntries())
-- text1
-- does not work
tableEntries = pairs({
name = {"John", "Jane", "Bob"},
age = {30, 25, 40},
city = {"New York", "Los Angeles", "Chicago"}
})
print(tableEntries)
-- function: 0x5627946f14f0
print(tableEntries())
-- stdin:7: bad argument #1 to 'tableEntries' (table expected, got no value)
-- stack traceback:
-- C: in function 'tableEntries'
-- stdin:7: in main chunk
-- C: in ?
I would expect it to return the next key value pair but it's saying the
Is there some other normal table iterator function that yields a normal iterator instead of whatever
Edit: Code got repeated twice, removed duplicate, added outputs
https://redd.it/1hk4nay
@r_lua
I am familiar with the concept of iterators in other languages, but I can't figure out how to get normal iterator behavior out of lua tables. The top example works normally with string iterators, but the bottom does not with table iterators.
-- works
stringEntries = string.gmatch("text1,text2,text3", "(^,+)")
print(stringEntries)
-- function: 0x5627c89b62c0
print(stringEntries())
-- text1
-- does not work
tableEntries = pairs({
name = {"John", "Jane", "Bob"},
age = {30, 25, 40},
city = {"New York", "Los Angeles", "Chicago"}
})
print(tableEntries)
-- function: 0x5627946f14f0
print(tableEntries())
-- stdin:7: bad argument #1 to 'tableEntries' (table expected, got no value)
-- stack traceback:
-- C: in function 'tableEntries'
-- stdin:7: in main chunk
-- C: in ?
I would expect it to return the next key value pair but it's saying the
tableEntries iterator expected a table as an argument? What argument would I give to an iterator function created from a table already?Is there some other normal table iterator function that yields a normal iterator instead of whatever
pairs does/does not do?Edit: Code got repeated twice, removed duplicate, added outputs
https://redd.it/1hk4nay
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Lua garbage collection
In Programming in Lua chapter 11.6 - String Buffers the author demonstrates a pitfall for reading files that can be slow due to how garbage collection works in Lua. I'm trying to test this myself so I created a 350KB text file and tried to read it using this code:
local buff = ""
for line in io.lines('data.txt') do
buff = buff .. line .. "\n"
end
The author claimed that reading a file of this size using this code would take almost a minute. But in my case it executed in less than a second. Are the docs outdated? Is there some under the hood optimization? or am I doing something differently?
https://redd.it/1hk6ekt
@r_lua
In Programming in Lua chapter 11.6 - String Buffers the author demonstrates a pitfall for reading files that can be slow due to how garbage collection works in Lua. I'm trying to test this myself so I created a 350KB text file and tried to read it using this code:
local buff = ""
for line in io.lines('data.txt') do
buff = buff .. line .. "\n"
end
The author claimed that reading a file of this size using this code would take almost a minute. But in my case it executed in less than a second. Are the docs outdated? Is there some under the hood optimization? or am I doing something differently?
https://redd.it/1hk6ekt
@r_lua
Couloir 14: VR installation to embark the visitor in an archive of (imaginary) lost+found documents.
https://github.com/astrofra/art-couloir-14
https://redd.it/1hk7qnj
@r_lua
https://github.com/astrofra/art-couloir-14
https://redd.it/1hk7qnj
@r_lua
GitHub
GitHub - astrofra/art-couloir-14: VR installation to embark the visitor in an archive of (imaginary) lost+found documents.
VR installation to embark the visitor in an archive of (imaginary) lost+found documents. - astrofra/art-couloir-14
REDM Coding Issue
I have a friend coding a REDM server and he needs the correct hash for the Lancaster Repeater. I have no idea where to look for this in the RDR2 list and he's pulling his hair trying to figure it out. Can anyone help?
https://redd.it/1hkbwf9
@r_lua
I have a friend coding a REDM server and he needs the correct hash for the Lancaster Repeater. I have no idea where to look for this in the RDR2 list and he's pulling his hair trying to figure it out. Can anyone help?
https://redd.it/1hkbwf9
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Is there a way to convert a .lua file into a .xml file?
I am trying to make a mod of a game that used .xml files, I want to know if there is a way to convert it so I don't have to learn a whole now programing language. If you need any information on what I am using, I will gladly provide
https://redd.it/1hkc7i5
@r_lua
I am trying to make a mod of a game that used .xml files, I want to know if there is a way to convert it so I don't have to learn a whole now programing language. If you need any information on what I am using, I will gladly provide
https://redd.it/1hkc7i5
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How do i make a lua loading system
Hey, it might seem like a weird question but i’m using luajit, i saw someone make a lua loader inside of their lua in order to interact with the menu in the way of making checkboxes, sliders dropdowns etc
How would someone go about doing this? I have a menu ready to go with checkboxes, sliders, dropdowns etc but
Is this an api specific thing or is it a luajit thing?
https://redd.it/1hkghhv
@r_lua
Hey, it might seem like a weird question but i’m using luajit, i saw someone make a lua loader inside of their lua in order to interact with the menu in the way of making checkboxes, sliders dropdowns etc
How would someone go about doing this? I have a menu ready to go with checkboxes, sliders, dropdowns etc but
Is this an api specific thing or is it a luajit thing?
https://redd.it/1hkghhv
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Help for a timer.create (Gmod Server)
Hello everyone, a few years ago someone gave me a code for my Gmod DarkRP server for automatically launches the ulx playsound ambientdistantbattle.mp3 command every 30 minutes
It was like this :
timer.Create("PlaySound", 1800, 0, function()
ulx playsound("ambientdistantbattle.mp3")
end)
But I think something is still missing...
https://redd.it/1hm164c
@r_lua
Hello everyone, a few years ago someone gave me a code for my Gmod DarkRP server for automatically launches the ulx playsound ambientdistantbattle.mp3 command every 30 minutes
It was like this :
timer.Create("PlaySound", 1800, 0, function()
ulx playsound("ambientdistantbattle.mp3")
end)
But I think something is still missing...
https://redd.it/1hm164c
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
A flexible serialization library (ldump)
The library
Was writing saves for the LOVE game I was writing, was unable to find any library that would be able to fully all of the game state, including AIs, which contain functions with upvalues, tables as keys, circular references etc. I didn't want to manually do partial saves and write tons of boilerplate, so I wrote the thing myself. Right now I am finished with the game (though the game fully isn't), and thought that the library is one of the best of my works, so it may be a good idea to show it to somebody.
It is a to-code serialization, the result is a valid lua expression that can be just
It is on the slower side and produces quite a large output, though, modern compression does wonders, and the saves of quite a large multi-layered level with complex entities weigh about 1 MB and take less than a second. I am looking for feedback, if you have any ideas on how to improve the performance, the API, the documentation or anything else, I would be glad to work with them.
P.S. Some time after writing and debugging the ldump, I found the bitser, which is in many ways better, which was quite a hit for me morally. Though, ldump can customize serialization a bit better, and this way allows to (de)serialize userdata and threads in places where well-configured bitser would produce placeholders (at least it seems that way), so I hope it has some place under the sun and may be useful to somebody.
P.P.S There is a fundamental issue with serializing dynamic data, that after deserializing the
I would be really glad if my library would be useful to someone else.
https://redd.it/1hm30fq
@r_lua
The library
Was writing saves for the LOVE game I was writing, was unable to find any library that would be able to fully all of the game state, including AIs, which contain functions with upvalues, tables as keys, circular references etc. I didn't want to manually do partial saves and write tons of boilerplate, so I wrote the thing myself. Right now I am finished with the game (though the game fully isn't), and thought that the library is one of the best of my works, so it may be a good idea to show it to somebody.
It is a to-code serialization, the result is a valid lua expression that can be just
loaded. Behind the scenes, it does some cool stuff like deconstructing closures into the function and its upvalues and reassembling them back. It is also highly customizable, you can quite comfortably define a serialization function for a metatable or for a concrete values (this becomes useful for threads and userdata, which can't be strictly serialized and don't have metatables, but sometimes need to be somehow recreated when the data loads).It is on the slower side and produces quite a large output, though, modern compression does wonders, and the saves of quite a large multi-layered level with complex entities weigh about 1 MB and take less than a second. I am looking for feedback, if you have any ideas on how to improve the performance, the API, the documentation or anything else, I would be glad to work with them.
P.S. Some time after writing and debugging the ldump, I found the bitser, which is in many ways better, which was quite a hit for me morally. Though, ldump can customize serialization a bit better, and this way allows to (de)serialize userdata and threads in places where well-configured bitser would produce placeholders (at least it seems that way), so I hope it has some place under the sun and may be useful to somebody.
P.P.S There is a fundamental issue with serializing dynamic data, that after deserializing the
== breaks, because the metatables are not equal by reference. This is the case for any serialization library, but I have a solution in development.I would be really glad if my library would be useful to someone else.
https://redd.it/1hm30fq
@r_lua
GitHub
GitHub - girvel/ldump: Serialization library for any lua data
Serialization library for any lua data. Contribute to girvel/ldump development by creating an account on GitHub.
Another Lil help
Someone who knows a lot about Luau/Lua, can you point me a someone learn about developing games on Roblox, (idk :/)
Thx
https://redd.it/1hm6i5n
@r_lua
Someone who knows a lot about Luau/Lua, can you point me a someone learn about developing games on Roblox, (idk :/)
Thx
https://redd.it/1hm6i5n
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
A question.
Does anyone know how I can make an application using lua pure? I'm a beginner and I would like to have a GUI and not just the console, and without having to download anything else on the side.
https://redd.it/1hmmjex
@r_lua
Does anyone know how I can make an application using lua pure? I'm a beginner and I would like to have a GUI and not just the console, and without having to download anything else on the side.
https://redd.it/1hmmjex
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
StellarTrace a simple trace observer in lua
https://github.com/OUIsolutions/StellarTrace
https://redd.it/1hmp8ke
@r_lua
https://github.com/OUIsolutions/StellarTrace
https://redd.it/1hmp8ke
@r_lua
GitHub
GitHub - OUIsolutions/StellarTrace: A lua Lib to generate observability
A lua Lib to generate observability. Contribute to OUIsolutions/StellarTrace development by creating an account on GitHub.
"Right tool for the right job" is an exaggareted statement.
Hello there !
In this post I want to express my opinions about current software development practices + some little ranting about it.
As the noscript says, we're used to be told that out there we have specialized programming languages for many areas of development, we have JavaScript for web, we have C# for games and Python for machine learning.
Right tool for the right job, right? Well, I couldn't disagree more. Most of these "industry standards" come mostly from popularity and trends alone and it rarely has anything to do with actual efficiency and technical decisions.
Take JavaScript for example. It is a complete disaster for the web and even for software development. Instead of having simple HTML pages that are rendered and sent by the server, they put all the rendering and data gathering on the client with silly and over-engineered JS noscripts that I find completely unnecessary. What does a website do specially compared to it's 10 years old version? Websites today put hassle on even strong computers with the amount of resources they consume. And let's not mention ElectronJS apps, that are so much worse than native alternatives written in Java or other languages.
What does that have to do with Lua? I recently discovered Lua through game development and I can't believe how capable it is of doing many things like backends with Lapis or other stuff. The overhead is so little, the syntax is so easy and the JIT is blazingly fast, reaching even C-like performance in some scenarios.
I've built stuff in Lua, from games, to SSR-ed websites and machine learning algorithms. I might agree the ecosystem is not as huge and documented or full of features like other languages, but it has enough for what most startups or individuals are aiming for, that while keeping a small overhead footprint, fast performance and rapid prototyping.
I am not necessarily trashing on other languages (except JavaScript which ruined performance and forces people to buy new computers due to it's trash performance and huge overhead) but Lua deserved a better spot and more popularity. I find it highly capable and in combination with C it's probably, in my eyes, the greatest GPL out there. Prior to switching to Lua, I was an avid user of Python and Java. Python is my first love, allowed me learn programming and web development, but it's limitations and overhead started to become more clearer and unsettling for me the more experience I've got. Java is also great, fast, and forces people to organize their code well. But coding in Java is not as fast and fun as doing it in Python or Lua.
If I were to choose, my toolbox would include C, Lua and Java but sadly I am forced to work with JS and respect my superior's orders to respect deadlines and ignore optimization by writing tons of glue and spaghetti code.
https://redd.it/1hms0k0
@r_lua
Hello there !
In this post I want to express my opinions about current software development practices + some little ranting about it.
As the noscript says, we're used to be told that out there we have specialized programming languages for many areas of development, we have JavaScript for web, we have C# for games and Python for machine learning.
Right tool for the right job, right? Well, I couldn't disagree more. Most of these "industry standards" come mostly from popularity and trends alone and it rarely has anything to do with actual efficiency and technical decisions.
Take JavaScript for example. It is a complete disaster for the web and even for software development. Instead of having simple HTML pages that are rendered and sent by the server, they put all the rendering and data gathering on the client with silly and over-engineered JS noscripts that I find completely unnecessary. What does a website do specially compared to it's 10 years old version? Websites today put hassle on even strong computers with the amount of resources they consume. And let's not mention ElectronJS apps, that are so much worse than native alternatives written in Java or other languages.
What does that have to do with Lua? I recently discovered Lua through game development and I can't believe how capable it is of doing many things like backends with Lapis or other stuff. The overhead is so little, the syntax is so easy and the JIT is blazingly fast, reaching even C-like performance in some scenarios.
I've built stuff in Lua, from games, to SSR-ed websites and machine learning algorithms. I might agree the ecosystem is not as huge and documented or full of features like other languages, but it has enough for what most startups or individuals are aiming for, that while keeping a small overhead footprint, fast performance and rapid prototyping.
I am not necessarily trashing on other languages (except JavaScript which ruined performance and forces people to buy new computers due to it's trash performance and huge overhead) but Lua deserved a better spot and more popularity. I find it highly capable and in combination with C it's probably, in my eyes, the greatest GPL out there. Prior to switching to Lua, I was an avid user of Python and Java. Python is my first love, allowed me learn programming and web development, but it's limitations and overhead started to become more clearer and unsettling for me the more experience I've got. Java is also great, fast, and forces people to organize their code well. But coding in Java is not as fast and fun as doing it in Python or Lua.
If I were to choose, my toolbox would include C, Lua and Java but sadly I am forced to work with JS and respect my superior's orders to respect deadlines and ignore optimization by writing tons of glue and spaghetti code.
https://redd.it/1hms0k0
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community