can you learn lua as 13 year old?
im a ninth grader that would like to learn lua for obiously a roblox game, however is it possible for me to do so? ill probably be too busy w school to learn every day but it will be like 4 or 3 times per week? im also pretty decent at math (but i can go back to learn old things that i never understood if needed) and i dont think im THAT dumb
https://redd.it/1j3j2ci
@r_lua
im a ninth grader that would like to learn lua for obiously a roblox game, however is it possible for me to do so? ill probably be too busy w school to learn every day but it will be like 4 or 3 times per week? im also pretty decent at math (but i can go back to learn old things that i never understood if needed) and i dont think im THAT dumb
https://redd.it/1j3j2ci
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Need an edit for a .lua folding function
Hello everyone,
I am currently working with a conky on my Linux box that employs .lua. Currently it takes a paragraph of weather conditions denoscription and splits it into 4 rows of text. It currently breaks at 20, 40, and 60 characters, but this causes words to be split into two rows of text. I have been working with chatGPT, asking it to edit so that the break occurs at the closes space to the 22nd character, but all its solutions do not work.
Non working examples:
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast | awk '{print substr($0, 1, match(substr($0, 1, 22), /[^ ]*$/) - 1)}'}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast | awk '{print substr($0, 1, match(substr($0, 1, 22), /^ $/) - 1)}'}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweather_conky_noscript/daily_forecast | awk '{print substr($0, 1, match(substr($0, 1, 22), /[^ ]$/) - 1)}'}
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast | awk '{match(substr($0,1,22), /.* /); print substr($0,1,RSTART-1)}'}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast | awk '{match(substr($0,1,22), /. /); print substr($0,1,RSTART-1)}'}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweather_conky_noscript/daily_forecast | awk '{match(substr($0,1,22), /. /); print substr($0,1,RSTART-1)}'}
Here is the line I need edited:
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c1-20}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c1-20}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c1-20}
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c21-40}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c21-40}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c21-40}$font
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c41-60}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c41-60}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c41-60}
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c61-80}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c61-80}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c61-80}
Can anyone help?
Thank you for reading,
Logan
https://redd.it/1j3llx4
@r_lua
Hello everyone,
I am currently working with a conky on my Linux box that employs .lua. Currently it takes a paragraph of weather conditions denoscription and splits it into 4 rows of text. It currently breaks at 20, 40, and 60 characters, but this causes words to be split into two rows of text. I have been working with chatGPT, asking it to edit so that the break occurs at the closes space to the 22nd character, but all its solutions do not work.
Non working examples:
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast | awk '{print substr($0, 1, match(substr($0, 1, 22), /[^ ]*$/) - 1)}'}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast | awk '{print substr($0, 1, match(substr($0, 1, 22), /^ $/) - 1)}'}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweather_conky_noscript/daily_forecast | awk '{print substr($0, 1, match(substr($0, 1, 22), /[^ ]$/) - 1)}'}
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast | awk '{match(substr($0,1,22), /.* /); print substr($0,1,RSTART-1)}'}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast | awk '{match(substr($0,1,22), /. /); print substr($0,1,RSTART-1)}'}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweather_conky_noscript/daily_forecast | awk '{match(substr($0,1,22), /. /); print substr($0,1,RSTART-1)}'}
Here is the line I need edited:
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c1-20}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c1-20}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c1-20}
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c21-40}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c21-40}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c21-40}$font
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c41-60}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c41-60}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c41-60}
${execi 60 sed -n '6p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c61-80}${goto 135}${execi 60 sed -n '13p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c61-80}${goto 255}${execi 60 sed -n '20p' /home/logansfury/.conky/forlogan/conky/barographe/Accuweatherconkynoscript/dailyforecast|cut -c61-80}
Can anyone help?
Thank you for reading,
Logan
https://redd.it/1j3llx4
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Why Every Programmer Should Learn Lua
https://levelup.gitconnected.com/why-every-programmer-should-learn-lua-6d6a8bafbeba?sk=1f7d18e4fe2bddb160e7ca11f2319e70
https://redd.it/1j3xbks
@r_lua
https://levelup.gitconnected.com/why-every-programmer-should-learn-lua-6d6a8bafbeba?sk=1f7d18e4fe2bddb160e7ca11f2319e70
https://redd.it/1j3xbks
@r_lua
Medium
Why Every Programmer Should Learn Lua
Mastering the world’s simplest language, Lua teaches lessons that improve your programming skills
Is it possible?
So, if there is an IDE, that like, lets you make a game with LUA, that isn't LOVE2D, or ZeroBrane Studio, I wanna know, because I wanna take the challenge.
https://redd.it/1j3y01d
@r_lua
So, if there is an IDE, that like, lets you make a game with LUA, that isn't LOVE2D, or ZeroBrane Studio, I wanna know, because I wanna take the challenge.
https://redd.it/1j3y01d
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Love2d or defold?
After I read this kind of question many ppl always recommend love2d or defold and I can’t decide😅.
I have some little experience in game dev using pygame python and unity
I plan to make 2d game and I see a lot of u guys recommend both of these
So I want to focus only one tools(I’m really bad at learning many things in same time)
Can you tell me pros and cons? Which should I choose? Thx a lot
https://redd.it/1j4ncfj
@r_lua
After I read this kind of question many ppl always recommend love2d or defold and I can’t decide😅.
I have some little experience in game dev using pygame python and unity
I plan to make 2d game and I see a lot of u guys recommend both of these
So I want to focus only one tools(I’m really bad at learning many things in same time)
Can you tell me pros and cons? Which should I choose? Thx a lot
https://redd.it/1j4ncfj
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Best OpenGL binding for LuaJIT?
I'm looking to mess around with a simple 3D voxel renderer/engine in Lua, just for fun. My first step is to find an opengl binding, and so far I only found the following two:
https://github.com/nanoant/glua
https://github.com/sonoro1234/LuaJIT-GL
The first one seems a bit more involved but was last updated 12 years ago. The second was last updated about 6 months ago.
I currently have close to zero experience in OpenGL (hence, this learning excersive) so I'm not sure how to compare the two. Any pointers or guidance would be much appreciated!
1. Do you have an opengl Lua binding (that supports LuaJIT) which you would recommend?
2. If not, which of the two above would you recommend?
3. Or, if the two above are both for some critical reason unusuable, would you recommend I make my own FFI bindings instead?
Note that I do not care which OpenGL version it uses (so something above 1.x would be preferable), and that it needs to have LuaJIT support, not just PUC Lua (So moongl is out of the question).
Thanks!
https://redd.it/1j4y6dn
@r_lua
I'm looking to mess around with a simple 3D voxel renderer/engine in Lua, just for fun. My first step is to find an opengl binding, and so far I only found the following two:
https://github.com/nanoant/glua
https://github.com/sonoro1234/LuaJIT-GL
The first one seems a bit more involved but was last updated 12 years ago. The second was last updated about 6 months ago.
I currently have close to zero experience in OpenGL (hence, this learning excersive) so I'm not sure how to compare the two. Any pointers or guidance would be much appreciated!
1. Do you have an opengl Lua binding (that supports LuaJIT) which you would recommend?
2. If not, which of the two above would you recommend?
3. Or, if the two above are both for some critical reason unusuable, would you recommend I make my own FFI bindings instead?
Note that I do not care which OpenGL version it uses (so something above 1.x would be preferable), and that it needs to have LuaJIT support, not just PUC Lua (So moongl is out of the question).
Thanks!
https://redd.it/1j4y6dn
@r_lua
GitHub
GitHub - nanoant/glua: glua = LuaJIT + FFI + OpenGL/GLUT
glua = LuaJIT + FFI + OpenGL/GLUT. Contribute to nanoant/glua development by creating an account on GitHub.
i'm very new to coding in Lua, and i have a couple questions about it.
the first image is from a lua learning game in Roblox, where "MyPart" is the part we were working with, the second one is from the same game, and i have a few questions about the logic of lua. (feel free to correct me if im wrong in any type of way!!)
First of all, what is "Workspace"?
Why the periods after some words, and why those words? (first pic)
Why do i have to make some words go under others? (check second pic for refrence)
i could go on, and on because there are so many random things in lua that i'm just supposed to know for some reason i guess.
https://redd.it/1j50576
@r_lua
the first image is from a lua learning game in Roblox, where "MyPart" is the part we were working with, the second one is from the same game, and i have a few questions about the logic of lua. (feel free to correct me if im wrong in any type of way!!)
First of all, what is "Workspace"?
Why the periods after some words, and why those words? (first pic)
Why do i have to make some words go under others? (check second pic for refrence)
i could go on, and on because there are so many random things in lua that i'm just supposed to know for some reason i guess.
https://redd.it/1j50576
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Is lua good in 2025 for learning as new developer?
I have a solid understanding of golang and java and i have made couple of projects with it, recently i came across lua and everyone says that its so underrated and can be use in so many other things , but all i can find is people are using this mostly for game development , and i don't want to follow that track , so will it be good learning lua as a new developer for building different projects apart from game dev, Thanks! : )
https://redd.it/1j557eh
@r_lua
I have a solid understanding of golang and java and i have made couple of projects with it, recently i came across lua and everyone says that its so underrated and can be use in so many other things , but all i can find is people are using this mostly for game development , and i don't want to follow that track , so will it be good learning lua as a new developer for building different projects apart from game dev, Thanks! : )
https://redd.it/1j557eh
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
No LuaLS workspace found
How to use the Lua language server in my lazyvim?
Do I need to have a LuaLS workspace in my .config/nvim or a workspace in every project??
Does anyone use Lazyvim and is getting the same error using Lua 5.4.7?
LazyDev does it have a UI similar to "lazyExtras"?
Why isn't the "lazydev" screen showing up? What do I need to fix to make it work?
https://preview.redd.it/uzqrs1rwv4ne1.png?width=812&format=png&auto=webp&s=1ce34754bdeb25ce54d7ec7bbc5b25cf04ee7f21
https://redd.it/1j566mx
@r_lua
How to use the Lua language server in my lazyvim?
Do I need to have a LuaLS workspace in my .config/nvim or a workspace in every project??
Does anyone use Lazyvim and is getting the same error using Lua 5.4.7?
LazyDev does it have a UI similar to "lazyExtras"?
Why isn't the "lazydev" screen showing up? What do I need to fix to make it work?
https://preview.redd.it/uzqrs1rwv4ne1.png?width=812&format=png&auto=webp&s=1ce34754bdeb25ce54d7ec7bbc5b25cf04ee7f21
https://redd.it/1j566mx
@r_lua
Lua Meetup in Bay Area at Roblox
Hey everyone - I work at Roblox, and we want to host a meetup at our office in San Mateo with food, drinks, and speakers. Would anyone local be interested in attending? We also have several open front-end developer roles that we are looking to fill. Let me know if you're interested / want to learn more.
https://redd.it/1j5827w
@r_lua
Hey everyone - I work at Roblox, and we want to host a meetup at our office in San Mateo with food, drinks, and speakers. Would anyone local be interested in attending? We also have several open front-end developer roles that we are looking to fill. Let me know if you're interested / want to learn more.
https://redd.it/1j5827w
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Help: LuaMacros - "rCtrl"/"lCtrl" not sending commands
I have been using LuaMacros for a couple of years now, and have an issue that I haven't been able to solve
Correct function example: When I press the "x" key on my second keyboard, LuaMacros sends binds "x" to F24 (there's no key for F24, but the system still recognizes it, so it's great for this application). An AutoHotkey noscript then reads that txt file, reads "x", and executes the operation I have specified.
Broken Fuction: Same as above, when I press the right "Ctrl" key on my second keyboard, LuaMacros sends binds "rCtrl" to F24. An AutoHotkey noscript then reads that txt file, reads "rCtrl", *but the operation does not execute.*
This issue occurs with the following key presses: r / l Control, r / l Shift, Escape, Alt, Windows key
What I have tried:
* I have confirmed that LuaMacros is indeed sending "rCtrl" by looking in the txt file it writes to.
* I have changed the code in LuaMacros to send a functioning character, "x", to see if the problem was with rCtrl" being sent. Still does not function.
* I have tried a completely unused character, "!", to see if the problem was with rCtrl" being sent *and* it needed to be a unique character. Still does not function.
I cannot figure this out. Driving me crazy. Any insight would be very helpful. Thank you!
https://redd.it/1j54331
@r_lua
I have been using LuaMacros for a couple of years now, and have an issue that I haven't been able to solve
Correct function example: When I press the "x" key on my second keyboard, LuaMacros sends binds "x" to F24 (there's no key for F24, but the system still recognizes it, so it's great for this application). An AutoHotkey noscript then reads that txt file, reads "x", and executes the operation I have specified.
Broken Fuction: Same as above, when I press the right "Ctrl" key on my second keyboard, LuaMacros sends binds "rCtrl" to F24. An AutoHotkey noscript then reads that txt file, reads "rCtrl", *but the operation does not execute.*
This issue occurs with the following key presses: r / l Control, r / l Shift, Escape, Alt, Windows key
What I have tried:
* I have confirmed that LuaMacros is indeed sending "rCtrl" by looking in the txt file it writes to.
* I have changed the code in LuaMacros to send a functioning character, "x", to see if the problem was with rCtrl" being sent. Still does not function.
* I have tried a completely unused character, "!", to see if the problem was with rCtrl" being sent *and* it needed to be a unique character. Still does not function.
I cannot figure this out. Driving me crazy. Any insight would be very helpful. Thank you!
https://redd.it/1j54331
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
tutorial hell
I am an absolute beginners
I mean, I know the very basics, Variables, math, functions, for loops, while loops, if/else statement...
But all I do is remember how to type a line of code
When I sit down and try to explore something or do something on my own, nothing comes to my mind. I get immersion is important and I want to try to figure out bits by myself. But all I end up typing is a line from whatever tutorial I saw and read.
https://redd.it/1j5crmx
@r_lua
I am an absolute beginners
I mean, I know the very basics, Variables, math, functions, for loops, while loops, if/else statement...
But all I do is remember how to type a line of code
When I sit down and try to explore something or do something on my own, nothing comes to my mind. I get immersion is important and I want to try to figure out bits by myself. But all I end up typing is a line from whatever tutorial I saw and read.
https://redd.it/1j5crmx
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How to start making games and stuff with lua for free?
I know theres roblox but try to avoid saying roblox or anything related to roblox, as im not a fan of the company.
Hello im a young adult with autism (if that maters), i struggle to learn things and be creative but yet i want to make a game or something of that nature. I still want to bypass theses struggles but where do i start with lua? i want to explore 2d and 3d but i feel like lua dosent offer much for 3d, i could be wrong.
https://redd.it/1j5ektj
@r_lua
I know theres roblox but try to avoid saying roblox or anything related to roblox, as im not a fan of the company.
Hello im a young adult with autism (if that maters), i struggle to learn things and be creative but yet i want to make a game or something of that nature. I still want to bypass theses struggles but where do i start with lua? i want to explore 2d and 3d but i feel like lua dosent offer much for 3d, i could be wrong.
https://redd.it/1j5ektj
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Gmod LUA
Anyone able to tell me why this doesn't work???
function(ply)
if IsValid(ply) then
local pname = ply:Nick() -- Get the player's name
RunConsoleCommand("sa", "setrank", pname, "verified")
end
end
ERROR:
[mc_simple_npcs\] addons/mc_simple_npcs/lua/mcs_npcs/sh_npcspawn.lua:78: attempt to call method 'Nick' (a nil value)
https://redd.it/1j5h3jj
@r_lua
Anyone able to tell me why this doesn't work???
function(ply)
if IsValid(ply) then
local pname = ply:Nick() -- Get the player's name
RunConsoleCommand("sa", "setrank", pname, "verified")
end
end
ERROR:
[mc_simple_npcs\] addons/mc_simple_npcs/lua/mcs_npcs/sh_npcspawn.lua:78: attempt to call method 'Nick' (a nil value)
https://redd.it/1j5h3jj
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
How to star with lua in Visual Studio
Hi all. I am a complete beginner to coding and have been trying to figure out lua in vs code. I have downloaded the lua binaries and the lua server extension and can run simple .lua files without issue.
However I am running into problems with trying to use the luahelper extension for debugging. The debug tool requires luasocket. To install luasocket I will need luarocks. To get luarocks to compile projects I will need mingw. I am wondering if there is a less painful way to get the debug tool to work, without making installations of things I do not understand?
https://redd.it/1j6pljn
@r_lua
Hi all. I am a complete beginner to coding and have been trying to figure out lua in vs code. I have downloaded the lua binaries and the lua server extension and can run simple .lua files without issue.
However I am running into problems with trying to use the luahelper extension for debugging. The debug tool requires luasocket. To install luasocket I will need luarocks. To get luarocks to compile projects I will need mingw. I am wondering if there is a less painful way to get the debug tool to work, without making installations of things I do not understand?
https://redd.it/1j6pljn
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Where Do I Start I Want To Learn Lua
im looking to learn lua but i don't got the money and im only 15 year old i try to learn in roblox game called noscripting school
https://redd.it/1j6ywbq
@r_lua
im looking to learn lua but i don't got the money and im only 15 year old i try to learn in roblox game called noscripting school
https://redd.it/1j6ywbq
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
3D in Lua
Please, suggest me way to do my physics (science) 3D simulation experiments with Lua.
https://redd.it/1j72maq
@r_lua
Please, suggest me way to do my physics (science) 3D simulation experiments with Lua.
https://redd.it/1j72maq
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
run and debug
what is the best lua extension is vs code to run and debug?
https://redd.it/1j7azbb
@r_lua
what is the best lua extension is vs code to run and debug?
https://redd.it/1j7azbb
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Sphinx-Lua-Ls: generate beautiful documentation for your Lua project using Lua Language Server and Sphinx
So, I've made a Sphinx plugin that uses Lua Language Server to automatically document your project.
Unlike other tools, this gives you flexibility of Sphinx combined with power of Lua Language Server analysis.
See the example output here (generated from this code), the rest of the documentation is here.
I'll appreciate your feedback and bug reports or feature requests, you can submit them to GitHub.
# Why?
There are several documentation tools for Lua, and none of them were suitable for my project:
1. `sphinx-lua` is another Sphinx plugin for Lua, and the inspiration for this project. Unfortunately, it only supports
2. `LDoc` is probably the most well-known one. Its annotations clash with Lua Language Server ones, so you'd have to choose one or the other. It is also limited by rigid structure of its output. It is great for quickly generating API references, but starts lacking with you need something advanced.
3. `doxyrest` is another Sphinx-based tool, but it uses Doxygen as a code analyzer, and, well, Doxygen is the weakest part in this project.
# Caveats
1. By default, sphinx-lua-ls will assume that comments in your code are written in reStructuredText. If you want Markdown, use MySt plugin.
2. Lua Language Server's output is not complete at the moment (see notes here). You might need to adjust your comments for better output.
3. This tool doesn't support C/C++ Lua extensions. If you have those, you'll have to document them manually, or use `LDoc` instead.
https://redd.it/1j7mn0l
@r_lua
So, I've made a Sphinx plugin that uses Lua Language Server to automatically document your project.
Unlike other tools, this gives you flexibility of Sphinx combined with power of Lua Language Server analysis.
See the example output here (generated from this code), the rest of the documentation is here.
I'll appreciate your feedback and bug reports or feature requests, you can submit them to GitHub.
# Why?
There are several documentation tools for Lua, and none of them were suitable for my project:
1. `sphinx-lua` is another Sphinx plugin for Lua, and the inspiration for this project. Unfortunately, it only supports
emmy-lua annotations, and has a number of bugs and missing features; plus, the author hasn't been active since 2023 and doesn't accept pull requests. I wanted to contribute new features to it initially, but writing a new version from scratch proved to be easier.2. `LDoc` is probably the most well-known one. Its annotations clash with Lua Language Server ones, so you'd have to choose one or the other. It is also limited by rigid structure of its output. It is great for quickly generating API references, but starts lacking with you need something advanced.
3. `doxyrest` is another Sphinx-based tool, but it uses Doxygen as a code analyzer, and, well, Doxygen is the weakest part in this project.
# Caveats
1. By default, sphinx-lua-ls will assume that comments in your code are written in reStructuredText. If you want Markdown, use MySt plugin.
2. Lua Language Server's output is not complete at the moment (see notes here). You might need to adjust your comments for better output.
3. This tool doesn't support C/C++ Lua extensions. If you have those, you'll have to document them manually, or use `LDoc` instead.
https://redd.it/1j7mn0l
@r_lua
Question about LuaJIT: when is a roundtrip from lua to C and back to lua illegal?
Hi all, I am confused about the following section from the luajit [website ](https://luajit.org/ext_ffi_semantics.html#init_table:~:text=One%20thing%20that%27s,function%20(or%20similar))
I am planning on writing a modding library in luajit. Thus lua(jit) code will be responsible for placing code hooks into an application and detour the execution into luajit. However, I am not sure if this is allowed given the paragraph on the website.
>One thing that's not allowed, is to let an FFI call into a C function get JIT-compiled, which in turn calls a callback, calling into Lua again. Usually this attempt is caught by the interpreter first and the C function is blacklisted for compilation.
>However, this heuristic may fail under specific circumstances: e.g. a message polling function might not run Lua callbacks right away and the call gets JIT-compiled. If it later happens to call back into Lua (e.g. a rarely invoked error callback), you'll get a VM PANIC with the message "bad callback". Then you'll need to manually turn off JIT-compilation with [jit.off()](https://luajit.org/ext_jit.html#jit_onoff_func) for the surrounding Lua function that invokes such a message polling function (or similar).
For example, I would write something like this:
// file: original.cpp
void render() {
doRender(); // bla bla
}
-- file: injection.lua
function customRender()
doCustomRender() -- more lua code
end
callback = ffi.cast("(void *)()", customRender)
hookingLibrary = ffi.load("myhookinglibrary.dll")
hookingLibrary.placeHookIntoMemory(addressOfOriginalRenderFunction, customRender)
Will `customRender` be optimized by luajit? When will it and when will it not?
https://redd.it/1j82199
@r_lua
Hi all, I am confused about the following section from the luajit [website ](https://luajit.org/ext_ffi_semantics.html#init_table:~:text=One%20thing%20that%27s,function%20(or%20similar))
I am planning on writing a modding library in luajit. Thus lua(jit) code will be responsible for placing code hooks into an application and detour the execution into luajit. However, I am not sure if this is allowed given the paragraph on the website.
>One thing that's not allowed, is to let an FFI call into a C function get JIT-compiled, which in turn calls a callback, calling into Lua again. Usually this attempt is caught by the interpreter first and the C function is blacklisted for compilation.
>However, this heuristic may fail under specific circumstances: e.g. a message polling function might not run Lua callbacks right away and the call gets JIT-compiled. If it later happens to call back into Lua (e.g. a rarely invoked error callback), you'll get a VM PANIC with the message "bad callback". Then you'll need to manually turn off JIT-compilation with [jit.off()](https://luajit.org/ext_jit.html#jit_onoff_func) for the surrounding Lua function that invokes such a message polling function (or similar).
For example, I would write something like this:
// file: original.cpp
void render() {
doRender(); // bla bla
}
-- file: injection.lua
function customRender()
doCustomRender() -- more lua code
end
callback = ffi.cast("(void *)()", customRender)
hookingLibrary = ffi.load("myhookinglibrary.dll")
hookingLibrary.placeHookIntoMemory(addressOfOriginalRenderFunction, customRender)
Will `customRender` be optimized by luajit? When will it and when will it not?
https://redd.it/1j82199
@r_lua