I keep getting the error message 'Unable to find the component class "TSynLuaSyn".'
So i'm working on getting Luamacros to work and i keep getting that as an error.
There probably is a very easy and simple solution but i can't find it so please someone that actually know what the hell is going on explain to me.
I'm really confused and out of ideas.
https://redd.it/l65hqg
@r_lua
how to change lua script version?
I updated my G HUB and Lua update to 5.4.2 version as well, is there a ways to change my Lua back to 5.4 or 5.3 version?
https://redd.it/l60fas
@r_lua
Translate a view in Lua
This translate function no longer works in Lua. Is there any solution to this?
-- move!
local nx = oh math.cos(ang2) dx
local ny = oh math.sin(ang2) dy
ic:translate(nx, ny)
https://redd.it/l5vkgl
@r_lua
Should Lua even be considered a programming language and a scripting one instead?
I'm not trying to hate Lua or anything but shouldn't it be referenced as a scripting language instead?
It's very high level and a lot of applications that use it sort of make their own version of Lua.
Examples, GLua: Garry's Mod, Source Lua: Source 2 engine.
https://redd.it/l5pir1
@r_lua
what is the best librarie for GUI in lua?
wanted a module to make graphical interfaces in lua for android to make apps
https://redd.it/l5fba8
@r_lua
Are there any simple audio libraries?
First option: Are there any simple audio libraries?I know thats a repeat of the title. Here is basically what I mean
I can load the file in with a name or variable inside a table
I can then play the audio from the variable (with something like .Play() or .PlaySync())
I can pause/stop/rewind/fast forward the audio (not required, preferred though)
Most audio libraries I have seen I didn't see a download to it, so if you do have a good audio library, please give a link to the download.
Secondary option (Probably a harder to understand solution required):
>!What im basically trying to do is save a command prompt, as it seems os.execute closes the command prompt after executing. !<
>!I mainly need this because I need to edit a powershell variable. This powershell variable is a Media.SoundPlayer object (since lua has no audio player api) !<
>!When looking through the lua page (https://www.lua.org/pil/22.html) I didn't see a reference to any other form of this.!<
What I have tried:
os.execute('powershell -c $mediaPlayer = (New-Object Media.SoundPlayer "'.. Path ..'");')
os.execute('powershell -c mediaPlayer.PlaySync();')
I also tried with variables to make sure it wasn't working:
os.execute('powershell -c $var1 = 555')
os.execute('powershell -c $var1')
This is my first time posting here so thank you if you do understand this and give a solution.
https://redd.it/l4za7b
@r_lua
Is there really no metamethod for negation?
I have a usecase in which the user can write some code in my software.
To simplify some operations for the user, some table classes allow for this kind of thing:
local tab = create_table_with_value(123) -- creates a table with {value = 123}
local a = tab + 1 -- this will be equivalent to a = tab.value + 1
print(a) -- prints 124
tab
directly, without invoking tab.value
, I defined all the necessary mathematical metamethods listed here.a = not tab
will always be false
.A luarocks build plugin for lua module with c/c++ based on xmake
https://github.com/xmake-io/luarocks-build-xmake/wiki/A-luarocks-build-plugin-for-lua-module-with-c--based-on-xmake
https://redd.it/l2o9ec
@r_lua
Discussion use API or Game Engine?
I have an idea for a game and I'm kinda new at Lua, so I ask more experienced people is it better to use API or Game Engine. I would be happy if I could suggest a good API / Game Engine depends what do you prefer
https://redd.it/l29hbw
@r_lua
LuaRT, a comprehensive Windows framework to develop in Lua
Dear Lua Community,
I'm proud to announce the initial public release of LuaRT, a comprehensive framework for Windows to develop in Lua. Please visit the project home page for more info: https://www.luart.org (the documentation part is still a work in progress)
LuaRT is based on Lua 5.4.1., and provides a specific runtime library for Windows operating systems (including functionnalities like files, sockets, zip...), without external dependencies.
LuaRT is beta material as bugs and caveats may occur...
Any specific questions about functionalities , bug reports should be discussed on the LuaRT community list.
Samir
https://redd.it/l1vc7g
@r_lua
Help with how to handle input for a programming problem
Hello, I'm learning Lua and found a website https://dmoj.ca/problem/aplusb that contains several problems. In the problem they give an input N that contains several numbers, my question is how do I emulate that in Lua?
Do I read those values from an file or is there a better way to do it?
In the Python example they use: N = int(input())
I program in VSCode not sure if that is relevant.
Thank you.
https://redd.it/l1ecfn
@r_lua
search entry debounce/timeout
Hello,
I am working on a simple media database search tool, and am stuck trying to figure out how to add a timeout to input entry. I am using the wonderful rofi blocks as the gui "tool kit". Rofi-blocks does most of the heavy lifting here...
> The module works by reading the stdin line by line to update rofi content. It can execute an application in the background, which will be used to communicate with the modi. The communication is made using file descriptors. The modi reads the output of the background program and writes events its input.
Current, crappy very wip code...
-- not in use yet
local function sleep(sec)
socket.sleep(sec)
end
local query = {input = nil, event = nil}
function Main()
-- on first run, display empty menu
local mainmenu = ParseView({'search something'})
--[[ query['input'] updates on each keypress,
for each new input value query fts5 table ]]
repeat
if query['input'] ~= '' then -- do not send empty query to sqlite/tracks, rethink?
ParseView( Tracks(query['input']) )
else
ParseView({'search something'})
end
until query['event'] == 'select entry' -- break when user presses return
end
function ParseView(lines)
local t = {
["message"] = "rofi message",
["prompt"] = "mpd",
["input action"] = "send",
["lines"] = lines
}
local rofiinput = json.encode(t)
io.write(rofiinput .. '\n') io.flush()
local selection = io.stdin:read('*l')
local rofioutput = json.decode(selection)
query'event' = rofioutput.name
query['input'] = rofioutput.value
end
Currently every keypress is making a new query to my sqlite table. Any idea if it would be feasible to add something like a 500ms timeout between keypresses, so ParseView( Tracks(query['input']) )
is not fired off until the user stops typing? I know the current design of my code would have to look quite a bit different from what i am doing now, but I am struggling to wrap my head around how to go about implementing it.
This very simple tutorial explains how to add debouncing to any javascript text entry, I leave it here because it describes the concept quick and clearly.
Any thoughts on whether this could be doable in pure lua? I am still in noob territory and this one is making my brain hurt. Any code/ideas/hints would be very appreciated. Thanks for your time.
https://redd.it/l07x05
@r_lua
What is the best lua game engine?
What is the best game engine that uses lua for 2D games? This question is opinion based so I would like you to state pros and cons rather than just answering with just the name of the game engine.
https://redd.it/kyl691
@r_lua
Lua, a misunderstood language
https://andregarzia.com/2021/01/lua-a-misunderstood-language.html
https://redd.it/ky8ts3
@r_lua
What tool is used to generate the browseable Lua source code on the Lua website?
I hope this is on-topic. I'm really curious as to what tool is used to generate the interactive Lua source code as hosted on the Lua website. It allows you to click on identifiers and jump to their definitions. I'd love to use this or something similar for my own C project. I couldn't find any information on this tool from a few cursory Google searches.
https://redd.it/ky6bbc
@r_lua
Who needs fibers? :: Emilua
https://emilua.gitlab.io/blog/2021/01/25/who-needs-fibers/
https://redd.it/l62jde
@r_lua
I need help pls
Can someone pls help me with my journey on learning Lua its really hard to find something to work off of I've tried tutorial videos, forums, reddit, websites etc. I still haven't found anything that has worked if someone could tutor me or something I would appreciate it
https://redd.it/l60lsf
@r_lua
LUA Logic Question
Hello,
I think I know the answer to this but I want to ask.
My assumption is that Lua and other programming languages are processed line by line, but my question is what happens if 2 while statements evaluate as true.
for example - some sudo code here
While 5 > 1
Write Hello
While 10 > 1
Write Cheese
Will the 2nd While statement ever get evaluated? Will Cheese ever get written? or will we see just an infinite loop of the word Hello being written?
If we take this one step further, the reason why i'm thinking of 2 separate while statements rather than putting them together is;
What if I was using delays/sleeps between events and so instead I wanted the following to happen
while 5 > 1
Write Hello, Sleep (100)
While 10 > 1
Write Cheese, Sleep (500)
But instead of them processing in order like that ; which would mean hello, sleep 100 and then write cheese, sleep 500, I want them to work as 2 separate events so Hello will continue to write over and over at 100ms intervals and Cheese will squeeze in the gap and write at 500ms intervals so you'd end up with something like
hello
hello
hello
hello
hello
cheese
hello
hello
hello
hello
hello
cheese
Maybe I am approaching this the wrong way.
https://redd.it/l5qxk2
@r_lua
I want to learn how to make a Roblox game. Where the heck do I start?
I want to learn lua but where in the world do I start I would want to use a free program since I don't really have much money.
https://redd.it/l5id7f
@r_lua
Hey... quick question
I wanna learn roblox lua and then learn python. Are they both similar in any-way, or 2 different languages? Python or roblox lua gonna be my first language
https://redd.it/l4yojd
@r_lua
Setting default working directory in ZeroBrane Studio
Is there a way to set the default working directory in ZeroBrane Studio? For example, I'd like to be able to go to the ZBS Console, type dofile("abc.lua")
, and have it execute file abc.lua
from this directory.
I know how to do configuration with user.lua
, and I've looked at the config docs on the ZBS site. But I cannot find an option that does this.
https://redd.it/l4xts6
@r_lua
Trying to install lua
I've downloaded it, copied it into my "C:\\Program Files\\LUA" folder and added "C:\\Program Files\\LUA" to "PATH" in variables
https://redd.it/l32q6n
@r_lua
Lua Weapon Base
I am attempting to make a weapon base for a star wars gmod server. Does anybody know where i can learn to do this i have searched alot
https://redd.it/l2e45l
@r_lua
Tool to monitor LuaJIT
Hi all,
Is there any tool like Visual VM to monitor LuaJIT. I am new to Lua and using Lua to create plugins for the Kong API Gateway.
https://redd.it/l1uhix
@r_lua
Efficient way to test for string permutations?
Hi,
I am trying to check for the presence of combinations of two strings.
So I have one set of possible matches for string 1. For instancestring1s={'Background', 'BG', 'Back', 'Backing'}
Then for the second string, possibilities arestring2s={'Vocals', 'Vocal', 'Vox', 'Voc', 'Vx'}
I need to be able to test for things like 'BG Vocals', 'Backing Vox', 'Vocals BG' ,etc
And the original strings I am parsing can look like 'BG Vocals 1', etc. That is, there can be additional text/chars that I will just ignore. The main thing is testing that there is a match from string1s, AND string2s.
I know I can just do for loops as needed, but was curious if someone has better idea.
thanks!
https://redd.it/l1vgae
@r_lua
Attempt to compare nil with number
Hi. I'm new to Lua and I've been trying to create a grenade for a mod of Half-Life: Alyx.
However I cannot get the timer on the grenade to work properly.
when I try to trigger the grenade I get a: "attempt to compare nil with number" error.
​
Here is the function:
function SetActive()
isActive = true
-- Here is where we activate a timer!
timeWhenActive = Time()
thisEntity:SetThink(ActiveTimer, 'ActiveTimer', 6)
end
function ActiveTimer()
-- If the explosion time has passed we explode
if (Time() - timeWhenActive >= explodeTime) then
TriggerGravinade()
return nil
end
thisEntity:EmitSound('XenGrenade.Blip')
end
https://redd.it/l0oegf
@r_lua
Need help with inserting into nested tables
Hello,
Ive been losing massive amounts of time figuring out tables in lua.
Im trying to create scripts for a PS1 game using BizHawk emulator.
what ive been trying to do is exactly this:
function GETSTATSVALUES()
-- GET STATS FROM ADDRESSES
LIFVALUE = mainmemory.readbyte(0x097A20)
POWVALUE = mainmemory.readbyte(0x097A22)
DEFVALUE = mainmemory.readbyte(0x097A24)
SKIVALUE = mainmemory.readbyte(0x097A26)
SPDVALUE = mainmemory.readbyte(0x097A28)
INTVALUE = mainmemory.readbyte(0x097A2A)
-- PUT STATS IN A TABLE
STATSLISTFULL = {'LIF' = {'LIF_VALUE' = LIFVALUE},
['POW'] = {['POWVALUE'] = POWVALUE},
['DEF'] = {['DEFVALUE'] = DEFVALUE},
['SKI'] = {['SKIVALUE'] = SKIVALUE},
['SPD'] = {['SPDVALUE'] = SPDVALUE},
['INT'] = {['INTVALUE'] = INTVALUE}}
end
function GETMONSTERGROWTH()
-- GET STATS FROM ADDRESSES
LIFGAIN = mainmemory.readbyte(0x97a42)
POWGAIN = mainmemory.readbyte(0x97a40)
DEFGAIN = mainmemory.readbyte(0x97a45)
SKIGAIN = mainmemory.readbyte(0x97a43)
SPDGAIN = mainmemory.readbyte(0x97a44)
INTGAIN = mainmemory.readbyte(0x97a41)
-- PUT STATS IN A TABLE
STATSLISTFULL = {['LIF'] = {['LIFGAIN'] = LIFGAIN},
['POW'] = {['POWGAIN'] = POWGAIN},
['DEF'] = {['DEFGAIN'] = DEFGAIN},
['SKI'] = {['SKIGAIN'] = SKIGAIN},
['SPD'] = {['SPDGAIN'] = SPDGAIN},
['INT'] = {['INTGAIN'] = INTGAIN}}
end
i tried to create a list which would contain the attributes (life, power, etc) and then inside each attribute key i would assign the relevant information about that stat, so i could access it like:
STATS\LIST_FULL['LIF'\]['LIF_GAIN'\]
doing the way i did above "STATS_LIST_FULL" is only getting values from the last run function, its overwriting, i tried using table.insert but with that i cant even get the code to run.
sorry if this is too simple, but im really having trouble doing this lol.
​
Thanks in advance
https://redd.it/kyohf1
@r_lua
Is there a lua execution walkthrough?
I’ve read the book, I’ve written plenty of lua scripts, both as part of larger embedded systems (games, mostly) and standalone (I did Advent of Code 2020 mostly in lua).
I still feel like there’s just a little I’m still not grokking.
Is there some website or tool that I can use to look at the execution of a given bit of code? I mean both in the sense of what bytecode is generated and executed, and the C code interpreting that bytecode.
While I rarely, if ever, use it for actual work, I found a similar exploration of Python bytecode to be illuminating and it’s been very useful for my mental model. Even a toy example was super useful, peeling back another layer of abstraction.
https://redd.it/ky9n7q
@r_lua
ORMs for LuaSql?
I've tried 4DaysORM and LuaORM. Both have a lot of problems. Is there an ORM that the lua community generally likes? I'd like to use LuaSQL and MariaDB.
https://redd.it/ky74ti
@r_lua
Heart - High performance Lua web server
https://github.com/Hyperspace-Logistics/heart
https://redd.it/kxx9ks
@r_lua