r/lua • u/kayinfire • Nov 01 '25
Does anyone else use lua as their main language for system automation and shell scripting?
it's no secret that Lua is heavily underrated. ironically, i used to be against lua until i understood how nifty it is as a language. i formerly thought that one had to use index or metatable to create objects, only to find out that i could do this
```
function NameOfObject(instanceVariable1, instanceVariable2)
return{
method1 = function(self)
end,
method2 = function(self)
end,
method3 = function(self)
end,
}
end
```
and just like that it overtook the appreciation i had for how objects can be created in other languages.
in a less subjective sense, however, given how ridiculuously fast lua is compared to the bulk of languages that are interpreted, i committed to it for all my scripting needs.
lua has now become my premier choice for automating anything related to my environment: my file system, my window manager, and even my system settings. it also greatly helps that i can automate repetitive and tedious text editing in neovim with lua as well.
i formerly used python for my scripting needs, and in retrospect, it's rather comical to me how poor python is as a scripting language compared to lua; it's a night and day difference. i can always trust lua for a startup time that is as good as instantaneous, whereas such a thing would be a fool's game in python.
granted, python does have all the abstractions one can hope for, but for system tasks, it's just outright overkill. one does not need a gazillian abstractions for system admin or shell scripting needs
anyways, i've rambled long enough. is there anyone else that uses lua for shell scripting needs and system automation, as opposed to roblox, C programming, game dev, and other low level tasks?
View all comments
Show parent comment
1
u/kayinfire Nov 10 '25
well done counterargument i must say. i appreciate you highlighting the suitability of my approach for smaller-scale programs. before arriving at that section, i was quite honestly starting to think you missed the part of the post where i said
i concede that for those realms, the advantages you speak of would indeed render the "metatable and index" approach the appropriate one.
nevertheless, the justification you provided for the typical pattern really goes to show why i made the post to begin with. in my experience, it is commonplace for one to use Lua for scenarios where the highest priority is given to performance. everyone uses Lua for those things. conversely, it is immensely rare that i see anyone using lua for personal programs or programs where readability is more desirable than performance, and your response in addition to the fact that the metatable approach is the prevailing approach testifies to that. the impression i get is largely that most people almost exclusively concern themselves with efficiency when it comes to lua. to a fair extent, this can't be helped considering the historical origins of lua and its marriage to embedded systems. however, i'd rather use lua as a personal scripting language on the grounds that i regard it as aesthetically pleasing and immensely performant relative to the alternatives, even with my approach. i suppose i am unorthodox in this regard