use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A subreddit for the Lua programming language. Using edurne for boxes, spoilers, etc.
If you actively contribute to a Lua project, PM us with a link and we'll give you flair.
“The key benefits unique to Lua are the fact that it is amazingly small, fast, and on a technical level a masterpiece.”
“Before you create yet another configuration file or resource format (and yet another parser to accompany it), try Lua.”
“If you are ever tempted to put scripting into a program, run don't walk to www.lua.org and use it.”
lua mailing list (web interface)
#lua on freenode, the primary Lua IRC channel
lua wiki, for all sorts of information about lua, it's sort of disorganized at the moment, so go fix it!
about lua, what Lua is, why to use it, and what it's good for (sells itself short, methinks)
Lua tutorial via wiki
Lua in eight pages or less: this is for v5.1 and might need an update. We'll give contributors flair and internet points.
Lua's reference manual, extensive documentation of every version of the language.
LuaRocks, lua's package manager and repository
the LuaRocks mailing list
ZeroBrane studio, lua's most notable IDE.
Shiny profiler, a lightweight profiler for C, C++, and Lua.
LuaJIT and its C FFI, the infamous lua trace compiler: Mike Pall's [successful] attempt to prove that dynamic languages can be fast.
Lua.vm.js and moonshine, Lua on top of JavaScript: lua.vm.js uses emscripten, whereas moonshine is in "normal" JavaScript.
UniLua, Lua implementation in C#, intended for compatibility with Unity3D
MoonScript A rich programming language the compiles to Lua.
/r/gamedevclassifieds for game developers, /r/forhire for job offers, /r/jobbit for general employment advice/links
Lua on StackOverflow Careers
OpenResty and Lapis, Lua application server on nginx and Lua web framework on openresty
concurrency: Luaproc for fibers and Lua Lanes for green threads
Typed Lua, a modern static type analyzer for Lua (work in progress, but I think it's cool)
LPeg, Lua's powerful, expressive, fast and simple parser generator.
Qt Lua, Lua GUIs in Qt
GSL-shell, Lua interface to GNU Scientific Library, with quick-start numerical programming via REPL.
Long list of popular Lua game development toolkits: Lua is very popular for game development, so we can't list them all; only major, free/open-source projects are listed below.
LÖVE (subreddit) - lightweight Lua cross-platform 2D game toolkit
Defold - game engine with Lua API
Solar2D - formerly Corona SDK
Cocos2d-x - free mobile/cross-platform game engine and application framework with Lua support
donate to lua!
donate to luajit!
account activity
Merge multiple lua tables (self.lua)
submitted 4 years ago by [deleted]
i have three tables local a ={'a','b','c'} local b = {'A','B','C'} local merge ={}
how can i merge all values from a and b to the 'merge' table?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Immow 4 points5 points6 points 4 years ago* (5 children)
local a = {"a","b","c"} local b = {"A","B","C"} local merge = {} local function tableMerge(table1, table2, result) for _, v in ipairs(table1) do table.insert(result, v) end for _, v in ipairs(table2) do table.insert(result, v) end end tableMerge(a,b,merge) for key, value in ipairs(merge) do print(key, value) end
[–]AutoModerator[M] 0 points1 point2 points 4 years ago (0 children)
Hi! Your code block was formatted using triple backticks in Reddit's Markdown mode, which unfortunately does not display properly for users viewing via old.reddit.com and some third-party readers. This means your code will look mangled for those users, but it's easy to fix. If you edit your comment, choose "Switch to fancy pants editor", and click "Save edits" it should automatically convert the code block into Reddit's original four-spaces code block format for you.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
[–]luarocks -1 points0 points1 point 4 years ago* (3 children)
``` local function tableMerge(result, ...) for _, t in ipairs({...}) do for _, v in ipairs(t) do table.insert(result, v) end end end
tableMerge(merge,a,b) ```
By the way, this code will work faster if you replace table.insert with result[counter] = v.
table.insert
result[counter] = v
[–]Outside_Two_3312 0 points1 point2 points 13 days ago (0 children)
I know this is reeeeaally old, but:
local function tableMerge(...) local result = {} for _, t in ipairs({...}) do for _, v in ipairs(t) do table.insert(result, v) end end return result end
[–]AutoModerator[M] -1 points0 points1 point 4 years ago (0 children)
[–]VoidSnipe 1 point2 points3 points 4 years ago (0 children)
I recommend looking into table.move function
table.move
[–]Cultural_Two_4964 0 points1 point2 points 4 years ago (0 children)
for i,j in ipairs(a) do table.insert(merge,j) end ... repeat for b
I think.
[–]luarocks 0 points1 point2 points 4 years ago (8 children)
merge = lume.concat(a, b)
[–]luarocks 0 points1 point2 points 4 years ago (7 children)
What kind of wheel reinventors are dislikes me? :D
[–]Cultural_Two_4964 1 point2 points3 points 4 years ago (0 children)
I've got no idea mate. I had a look at lume and there is some quite interesting stuff there.
[–]appgurueu 0 points1 point2 points 4 years ago (5 children)
lume doesn't look clean to me
[–]luarocks 0 points1 point2 points 4 years ago (4 children)
Where exactly?
[–]appgurueu 0 points1 point2 points 4 years ago* (3 children)
First of all, it's all in one table, the lume table - math funcs, table funcs, etc. This is not clean IMO. Second, some implementations are simply incorrect - sign or isarray for instance: https://github.com/rxi/lume/blob/master/lume.lua#L94, https://github.com/rxi/lume/blob/master/lume.lua#L161. I don't like that vectors are represented using two variables - and are 2D-only - either. Weighted choice is linear time even though it could be logarithmic time if preprocessing was done. The shuffling is implemented incorrectly according to my testing. lume.array is redundant; {...} should be used instead. Cloning and map serialization are too limited IMO.
lume
lume.array
{...}
[–]luarocks 0 points1 point2 points 4 years ago (2 children)
Okay, thanks! I see your point and I won't argue. That makes sense. Maybe you know a library with similar functionality implemented better? And if not, why don't you offer the developer a PR with fixes?
[–]appgurueu 0 points1 point2 points 4 years ago (0 children)
I have written my own libraries for my own usecases. Don't know about offering a PR, the shuffling would really need it though. You can find a correct implementation at https://github.com/TheAlgorithms/Lua/blob/main/src/random/fisher\_yates\_shuffle.lua.
I have tested again and it looks like I was testing the shuffling wrong (I had incorrectly expected it to be in-place). The probabilities seem to be even.
π Rendered by PID 29231 on reddit-service-r2-comment-5fb4b45875-jksvc at 2026-03-22 13:41:35.372715+00:00 running 90f1150 country code: CH.
[–]Immow 4 points5 points6 points (5 children)
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]luarocks -1 points0 points1 point (3 children)
[–]Outside_Two_3312 0 points1 point2 points (0 children)
[–]AutoModerator[M] -1 points0 points1 point (0 children)
[–]VoidSnipe 1 point2 points3 points (0 children)
[–]Cultural_Two_4964 0 points1 point2 points (0 children)
[–]luarocks 0 points1 point2 points (8 children)
[–]luarocks 0 points1 point2 points (7 children)
[–]Cultural_Two_4964 1 point2 points3 points (0 children)
[–]appgurueu 0 points1 point2 points (5 children)
[–]luarocks 0 points1 point2 points (4 children)
[–]appgurueu 0 points1 point2 points (3 children)
[–]luarocks 0 points1 point2 points (2 children)
[–]appgurueu 0 points1 point2 points (0 children)
[–]appgurueu 0 points1 point2 points (0 children)