What happened to lua-users.org
I'm sorry if this is an otherwise well-known fact, but I couldn't find any information about what happened with lua-users.org(unsurprising, considering google is good at anything but searching).
the website is semi-up, with the forum and wiki missing from it.
what happened to it?
https://redd.it/1jyd1yd
@r_lua
I'm sorry if this is an otherwise well-known fact, but I couldn't find any information about what happened with lua-users.org(unsurprising, considering google is good at anything but searching).
the website is semi-up, with the forum and wiki missing from it.
what happened to it?
https://redd.it/1jyd1yd
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
trying to start learning lua to make toblox mini games
idk hbow to start i know variables functions meaning loop and more but like idk how i start like what should i do after know the basics (variables etc ... ) can anyone help me with some suggetions and thank you !
https://redd.it/1jyjxyk
@r_lua
idk hbow to start i know variables functions meaning loop and more but like idk how i start like what should i do after know the basics (variables etc ... ) can anyone help me with some suggetions and thank you !
https://redd.it/1jyjxyk
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
ZeroBrane not recognizing "on.paint"
Hello! I just started goofing around with Lua so I can program for my Ti-Nspire CX. If I can keep from getting distracted long enough to actually learn Lua. I've started with using ZeroBrane Studio since that is what is recommended on the Lua site and it's specifically made for use with Lua. I am following tutorials on:
https://compasstech.com.au/TNS\_Authoring/Scripting/noscript\_tut1.html
I am of course starting out with "hello world", but I can't even get that to work. ZeroBrane doesn't seem to recognize the function "on.paint(gc)". It seems to think that the "on" is a variable. This is probably a simple solution but I'm not a programmer so I may be missing something. I have dabbled in programming over the years, but am definitely not a programmer. Thanks.
The output when I try to run the program is:
Program starting as '"/opt/zbstudio/bin/linux/x64/lua" -e "io.stdout:setvbuf('no')" "/home/brian/Downloads/TI-Nspire CX/My Programs/Compass Tech Course.lua"'.
Program 'lua' started in '/opt/zbstudio/myprograms' (pid: 1212772).
/opt/zbstudio/bin/linux/x64/lua: ...wnloads/TI-Nspire CX/My Programs/Compass Tech Course.lua:4: attempt to index global 'on' (a nil value)
stack traceback:
...wnloads/TI-Nspire CX/My Programs/Compass Tech Course.lua:4: in main chunk
\[C\]: at 0x00404f08
Program completed in 0.01 seconds (pid: 1212772).
function on.paint(gc)
gc:drawString("hello world", 0, 20)
end
https://redd.it/1jyksvz
@r_lua
Hello! I just started goofing around with Lua so I can program for my Ti-Nspire CX. If I can keep from getting distracted long enough to actually learn Lua. I've started with using ZeroBrane Studio since that is what is recommended on the Lua site and it's specifically made for use with Lua. I am following tutorials on:
https://compasstech.com.au/TNS\_Authoring/Scripting/noscript\_tut1.html
I am of course starting out with "hello world", but I can't even get that to work. ZeroBrane doesn't seem to recognize the function "on.paint(gc)". It seems to think that the "on" is a variable. This is probably a simple solution but I'm not a programmer so I may be missing something. I have dabbled in programming over the years, but am definitely not a programmer. Thanks.
The output when I try to run the program is:
Program starting as '"/opt/zbstudio/bin/linux/x64/lua" -e "io.stdout:setvbuf('no')" "/home/brian/Downloads/TI-Nspire CX/My Programs/Compass Tech Course.lua"'.
Program 'lua' started in '/opt/zbstudio/myprograms' (pid: 1212772).
/opt/zbstudio/bin/linux/x64/lua: ...wnloads/TI-Nspire CX/My Programs/Compass Tech Course.lua:4: attempt to index global 'on' (a nil value)
stack traceback:
...wnloads/TI-Nspire CX/My Programs/Compass Tech Course.lua:4: in main chunk
\[C\]: at 0x00404f08
Program completed in 0.01 seconds (pid: 1212772).
function on.paint(gc)
gc:drawString("hello world", 0, 20)
end
https://redd.it/1jyksvz
@r_lua
How realistic is it to write a dynamic website in Lua as a new programmer?
Basically noscript. I'm new to programming and learning C and Lua, but I'm not really sure where to start. I thought it would be fun to build a dynamic website in Lua since that would probably teach me some of the things I'd need to know for future projects, but I'd imagine that's probably over my head. Does anyone know if that's a realistic ask? If not, where should I start if I want to learn what's necessary to do something like this? Thanks!
https://redd.it/1jzoiif
@r_lua
Basically noscript. I'm new to programming and learning C and Lua, but I'm not really sure where to start. I thought it would be fun to build a dynamic website in Lua since that would probably teach me some of the things I'd need to know for future projects, but I'd imagine that's probably over my head. Does anyone know if that's a realistic ask? If not, where should I start if I want to learn what's necessary to do something like this? Thanks!
https://redd.it/1jzoiif
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
A little help with a code fixing task!
Hello everyone!
I'm fairly new to this, but I was assigned the below corrupted code as a test to fix it, and I can't figure it out. The code in question goes as follows:
function factorial(n)
if (n == 0) then
return 1
else
return n factorial(n - 1) -- The developer did not handle negative numbers. Prevent infinite recursion. You must check if n is lower than 0 then return something. You should be returning nil. Use elseif and then else
end
end
Now, what I was able to figure out is that I need to check if n is lower than 0, then return nil, which can be done by doing this:
function factorial(n)
if (n == 0) then
return 1
elseif (n < 0) then
return nil
else
return n factorial(n - 1)
end
end
But then I was told that this is incorrect, and I can't seem to figure out why. Would anyone be so kind as to point out the mistake and tell me if it's just the coding style, or maybe it is just blatantly incorrect?
https://redd.it/1k0u4fv
@r_lua
Hello everyone!
I'm fairly new to this, but I was assigned the below corrupted code as a test to fix it, and I can't figure it out. The code in question goes as follows:
function factorial(n)
if (n == 0) then
return 1
else
return n factorial(n - 1) -- The developer did not handle negative numbers. Prevent infinite recursion. You must check if n is lower than 0 then return something. You should be returning nil. Use elseif and then else
end
end
Now, what I was able to figure out is that I need to check if n is lower than 0, then return nil, which can be done by doing this:
function factorial(n)
if (n == 0) then
return 1
elseif (n < 0) then
return nil
else
return n factorial(n - 1)
end
end
But then I was told that this is incorrect, and I can't seem to figure out why. Would anyone be so kind as to point out the mistake and tell me if it's just the coding style, or maybe it is just blatantly incorrect?
https://redd.it/1k0u4fv
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Extended lua noscript for mpv
Hello,
I would like to make mpv play short clips as visualization, but:
- the first half of the track reversed with 0.8 speed
- then the original forward in normal speed and complete
- all videos are in subdurectories on a cloud-server
- endless play repetition
Actually, I have a code, which reverses everything and renames the originals into xxx_vorher and names the reversed into xxx_reverse. But it's always the full track in normal speed. What am I doing wrong?
Working noscript:
local utils = require 'mp.utils'
local base_folder = "C:\\Users\\ju-ra\\OneDrive - per ianua projekt eV\\mArple\\artwork\\ki"
function process_all_videos(folder)
local cmd = string.format('dir "%s" /b /s /a-d', folder)
local handle = io.popen(cmd)
local result = handle:read("*a")
handle:close()
for line in result:gmatch("[^\r\n]+") do
if line:match("%.mp4$") or line:match("%.mkv$") or line:match("%.avi$") then
if not line:match("_vorher%.") and not line:match("_reverse%.") then
local new_path = line:gsub("(%.%w+)$", "_vorher%1")
os.rename(line, new_path)
local reverse_path = line:gsub("(%.%w+)$", "_reverse%1")
local args = {
"ffmpeg", "-y",
"-i", new_path,
"-vf", "reverse",
"-af", "areverse",
reverse_path
}
mp.msg.info("Erstelle Reverse: " .. reverse_path)
utils.subprocess({ args = args, playback_only = false })
end
end
end
mp.msg.info("Alle Videos wurden umbenannt und Reverses erstellt.")
end
process_all_videos(base_folder)
mp.commandv("quit")
________________________
What I am trying to add:
local mp = require 'mp'
local started = false
local half_point = 0
local reversed = false
function reverse_and_play_forward()
if started then return end
started = true
local duration = mp.get_property_number("duration", 0)
half_point = duration / 2
-- Sprung zur Mitte und rückwärts abspielen
mp.set_property_number("speed", 1)
mp.set_property("playback-direction", "backward")
mp.commandv("seek", half_point, "absolute+exact")
reversed = true
-- Beobachte die Zeit
mp.observe_property("time-pos", "number", function(name, pos)
if reversed and pos and pos <= 0.1 then
-- Wenn Anfang erreicht, vorwärts abspielen
reversed = false
mp.set_property("playback-direction", "forward")
mp.set_property_number("speed", 1)
mp.commandv("seek", 0, "absolute+exact")
mp.unobserve_property(nil)
end
end)
end
mp.register_event("file-loaded", reverse_and_play_forward)
Thanks for every idea
https://redd.it/1k133wq
@r_lua
Hello,
I would like to make mpv play short clips as visualization, but:
- the first half of the track reversed with 0.8 speed
- then the original forward in normal speed and complete
- all videos are in subdurectories on a cloud-server
- endless play repetition
Actually, I have a code, which reverses everything and renames the originals into xxx_vorher and names the reversed into xxx_reverse. But it's always the full track in normal speed. What am I doing wrong?
Working noscript:
local utils = require 'mp.utils'
local base_folder = "C:\\Users\\ju-ra\\OneDrive - per ianua projekt eV\\mArple\\artwork\\ki"
function process_all_videos(folder)
local cmd = string.format('dir "%s" /b /s /a-d', folder)
local handle = io.popen(cmd)
local result = handle:read("*a")
handle:close()
for line in result:gmatch("[^\r\n]+") do
if line:match("%.mp4$") or line:match("%.mkv$") or line:match("%.avi$") then
if not line:match("_vorher%.") and not line:match("_reverse%.") then
local new_path = line:gsub("(%.%w+)$", "_vorher%1")
os.rename(line, new_path)
local reverse_path = line:gsub("(%.%w+)$", "_reverse%1")
local args = {
"ffmpeg", "-y",
"-i", new_path,
"-vf", "reverse",
"-af", "areverse",
reverse_path
}
mp.msg.info("Erstelle Reverse: " .. reverse_path)
utils.subprocess({ args = args, playback_only = false })
end
end
end
mp.msg.info("Alle Videos wurden umbenannt und Reverses erstellt.")
end
process_all_videos(base_folder)
mp.commandv("quit")
________________________
What I am trying to add:
local mp = require 'mp'
local started = false
local half_point = 0
local reversed = false
function reverse_and_play_forward()
if started then return end
started = true
local duration = mp.get_property_number("duration", 0)
half_point = duration / 2
-- Sprung zur Mitte und rückwärts abspielen
mp.set_property_number("speed", 1)
mp.set_property("playback-direction", "backward")
mp.commandv("seek", half_point, "absolute+exact")
reversed = true
-- Beobachte die Zeit
mp.observe_property("time-pos", "number", function(name, pos)
if reversed and pos and pos <= 0.1 then
-- Wenn Anfang erreicht, vorwärts abspielen
reversed = false
mp.set_property("playback-direction", "forward")
mp.set_property_number("speed", 1)
mp.commandv("seek", 0, "absolute+exact")
mp.unobserve_property(nil)
end
end)
end
mp.register_event("file-loaded", reverse_and_play_forward)
Thanks for every idea
https://redd.it/1k133wq
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Looking for assistance learning FiveM development
Hello, Firstly, Thank you for taking the time to read this.
My friend & I have been working on trying to learn FiveM development for about a month now as we slowly build up a server. We have been learning mainly through reddit posts, discussions and youtube videos on how to do majority of things and it's gotten us quite far.
We're hoping this post will reach someone who has knowledge in building FiveM servers or is knowledgeable in Lua and is willing to mentor us on some of the more intricate obstacles we are struggling with such as learning how to properly use exports and integrate noscripts to communicate with each other such as notifications, MDT etc.
If this seems like something that might interest you or if you are willing to help please contact me via Discord @ dino0831 We are both eager to learn and catch on quickly. Hope to hear from you soon :)
Thank you
https://redd.it/1k2ef8j
@r_lua
Hello, Firstly, Thank you for taking the time to read this.
My friend & I have been working on trying to learn FiveM development for about a month now as we slowly build up a server. We have been learning mainly through reddit posts, discussions and youtube videos on how to do majority of things and it's gotten us quite far.
We're hoping this post will reach someone who has knowledge in building FiveM servers or is knowledgeable in Lua and is willing to mentor us on some of the more intricate obstacles we are struggling with such as learning how to properly use exports and integrate noscripts to communicate with each other such as notifications, MDT etc.
If this seems like something that might interest you or if you are willing to help please contact me via Discord @ dino0831 We are both eager to learn and catch on quickly. Hope to hear from you soon :)
Thank you
https://redd.it/1k2ef8j
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Okay so im reaching out im not sure how to look up what im about to ask
Ive been getting bored with the games that i have been playing and i was told to look up the lua game on roblox but it tells you how to do it but it is confusing me just wondering if im the only one ? If you have any info much appreciated
https://redd.it/1k31xt8
@r_lua
Ive been getting bored with the games that i have been playing and i was told to look up the lua game on roblox but it tells you how to do it but it is confusing me just wondering if im the only one ? If you have any info much appreciated
https://redd.it/1k31xt8
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Lua learning
I have wanted to learn lua for a while but have not had the time, but now I do, so I am just curious whether how do I start? Because I took a look at couple videos and I have to be honest I did not understand or keep in mind any of that. If you guys would send me some useful resources or a starting point to learn lua I would appreciate it.
https://redd.it/1k38fsn
@r_lua
I have wanted to learn lua for a while but have not had the time, but now I do, so I am just curious whether how do I start? Because I took a look at couple videos and I have to be honest I did not understand or keep in mind any of that. If you guys would send me some useful resources or a starting point to learn lua I would appreciate it.
https://redd.it/1k38fsn
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Compiling lua
Hello I have a game where the files for lua were in .lu so I decompiled them and the decompiler doesn't have an option to compile them back into .lu so I was wondering if anyone knows of a compiler that concerts lua into .lu, btw the Lua is 5.1
https://redd.it/1k3dk0s
@r_lua
Hello I have a game where the files for lua were in .lu so I decompiled them and the decompiler doesn't have an option to compile them back into .lu so I was wondering if anyone knows of a compiler that concerts lua into .lu, btw the Lua is 5.1
https://redd.it/1k3dk0s
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Can I use custom C API functions from Lua bytecode?
I'm thinking of precompiling Lua noscripts I upload to an unmanned vehicle that has a custom C API noscript runner thing. Would this be possible/feasible?
https://redd.it/1k3x9au
@r_lua
I'm thinking of precompiling Lua noscripts I upload to an unmanned vehicle that has a custom C API noscript runner thing. Would this be possible/feasible?
https://redd.it/1k3x9au
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Confused with OR operator
"if The logical operators are and, or, and not. Like control structures, all logical operators consider false and nil as false and anything else as true. The operator and returns its first argument if it is false; otherwise, it returns its second argument. The operator or returns its first argument if it is not false; otherwise, it returns its second argument:
print(4 and 5) --> 5
print(nil and 13) --> nil
print(false and 13) --> false
print(4 or 5) --> 4
print(false or 5) --> 5
Both and and or use short-cut evaluation, that is, they evaluate their second operand only when necessary."
I might be being dumb here, but as I understand OR in most operations, it evaluates true when either side is evaluated to be true, so shouldn't the last statement be printing false? I see that it says that they only evaluate the second operand when necessary, but wouldn't the first operand being false in an OR statement cause it to look at the second?
https://redd.it/1k42jt2
@r_lua
"if The logical operators are and, or, and not. Like control structures, all logical operators consider false and nil as false and anything else as true. The operator and returns its first argument if it is false; otherwise, it returns its second argument. The operator or returns its first argument if it is not false; otherwise, it returns its second argument:
print(4 and 5) --> 5
print(nil and 13) --> nil
print(false and 13) --> false
print(4 or 5) --> 4
print(false or 5) --> 5
Both and and or use short-cut evaluation, that is, they evaluate their second operand only when necessary."
I might be being dumb here, but as I understand OR in most operations, it evaluates true when either side is evaluated to be true, so shouldn't the last statement be printing false? I see that it says that they only evaluate the second operand when necessary, but wouldn't the first operand being false in an OR statement cause it to look at the second?
https://redd.it/1k42jt2
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
I want to learn how to code with Lua - how do I start? where do I start?
For those who have experience with Lua, how did you start? where did you start?
All I know of Lua is that it is considered "simple" and that it is used for games - I really would like to somewhat grasp Lua so I can start considering making games myself.
https://redd.it/1k4ktdk
@r_lua
For those who have experience with Lua, how did you start? where did you start?
All I know of Lua is that it is considered "simple" and that it is used for games - I really would like to somewhat grasp Lua so I can start considering making games myself.
https://redd.it/1k4ktdk
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
Do I need require for each TU?
I'm not super familiar with LUA. I have an entry point of so called main noscript -
https://redd.it/1k4lisq
@r_lua
I'm not super familiar with LUA. I have an entry point of so called main noscript -
entry.lua, I have a Logger.lua that has the tools for exactly what it says. Main noscripts has access to logger via require. Now I have to use logging tools in Events.lua - do I also need a require or because Events.lua is already "included" in main noscript the logging definitions are exposed higher up the chain and I can use them? And if I dont - any potentials side-effects form including them via require to appease luals?https://redd.it/1k4lisq
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
A simple noscript to generate html code.
I just wanted to share this code to generate html code from lua, i made this because i don't like writing html and for fun to do something in lua. Any sugestions to improve it?
https://gitlab.com/-/snippets/4836971
https://redd.it/1k5qng1
@r_lua
I just wanted to share this code to generate html code from lua, i made this because i don't like writing html and for fun to do something in lua. Any sugestions to improve it?
https://gitlab.com/-/snippets/4836971
https://redd.it/1k5qng1
@r_lua
GitLab
Generate html code from lua ($4836971) · Snippets · GitLab
Differences between Lua and LuaJIT?
Hi all. I've been a casual user of Lua for years and of LuaJIT for just a few months. I am not clear on all of the differences I need to know when writing code.
I know that integer division (//) is not implemented in LuaJIT and that LuaJIT has increased interoperability with C (which I haven't yet used). Yesterday I wrote a bit of code for LuaJIT that produces differently formatted output between Lua (5.4) and LuaJIT (5.1).
It worries me that there might be more gotchas lurking and a cheat sheet of everything a Lua programmer should know when switching to LuaJIT would be really useful (before I start diving into Lua version changes and seeing of this is a Lua version difference and not a Lua/LuaJIT difference).
Can anyone help?
https://redd.it/1k60myn
@r_lua
Hi all. I've been a casual user of Lua for years and of LuaJIT for just a few months. I am not clear on all of the differences I need to know when writing code.
I know that integer division (//) is not implemented in LuaJIT and that LuaJIT has increased interoperability with C (which I haven't yet used). Yesterday I wrote a bit of code for LuaJIT that produces differently formatted output between Lua (5.4) and LuaJIT (5.1).
It worries me that there might be more gotchas lurking and a cheat sheet of everything a Lua programmer should know when switching to LuaJIT would be really useful (before I start diving into Lua version changes and seeing of this is a Lua version difference and not a Lua/LuaJIT difference).
Can anyone help?
https://redd.it/1k60myn
@r_lua
Reddit
From the lua community on Reddit
Explore this post and more from the lua community
simulate MicroLua on Mac?
Hi all,
I'm trying to make a DS game to be run via MicroLua DS on DSi. I'm using a 2020 MacBook Pro M1 computer.
To test my program, I first tried using MicroLua Simulator https://sourceforge.net/p/microlua/wiki/MicroLuaSimulator/ but I couldn't compile it.
Then I tried Desmume, using the instructions given here: https://sourceforge.net/p/microlua/wiki/DeSmuME/ but the gba slot it mentions was nowhere to be found.
what do?
https://redd.it/1k69cww
@r_lua
Hi all,
I'm trying to make a DS game to be run via MicroLua DS on DSi. I'm using a 2020 MacBook Pro M1 computer.
To test my program, I first tried using MicroLua Simulator https://sourceforge.net/p/microlua/wiki/MicroLuaSimulator/ but I couldn't compile it.
Then I tried Desmume, using the instructions given here: https://sourceforge.net/p/microlua/wiki/DeSmuME/ but the gba slot it mentions was nowhere to be found.
what do?
https://redd.it/1k69cww
@r_lua