33信息来源
13,303精选文章
168单词卡片
18照片图片
The Lua programming language
Lua编程语言
4chan /g/ · Anonymous · 2026-07-29 23:42 · 207 帖 · 原文 ↗
#1 The Lua programming language / Lua编程语言
Anonymous · 2026-07-29 23:42
Lua is a powerful, efficient, lightweight, embeddable scripting language. It supports several programming styles: procedural, object-oriented, functional, data-driven, and data description.
Lua是一种强大、高效、轻量且易于嵌入的脚本语言。它支持多种编程风格:过程式、面向对象、函数式、数据驱动和数据描述。
Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, runs by interpreting bytecode with a register-based virtual machine, and has automatic memory management with incremental garbage collection, making it ideal for configuration, scripting, and rapid prototyping.
Lua将简单的过程式语法与基于关联数组和可扩展语义的强大数据描述结构相结合。Lua是动态类型的,通过基于寄存器的虚拟机解释执行字节码,并具有带有增量垃圾回收的自动内存管理,使其成为配置、脚本编写和快速原型的理想选择。
Lua reference manual: https://www.lua.org/manual/5.4/manual.html
Lua Technology
Lua技术
>backend web development (production ready)
> 后端 Web 开发(生产环境就绪)
https://leafo.net/lapis/
>socket scripting (for writing a game server or a custom chat server or something)
> 套接字脚本编写(用于编写游戏服务器或自定义聊天服务器等)
https://lunarmodules.github.io/copas/
>game development
> 游戏开发
https://love2d.org/
>xmpp server
>XMPP服务器
https://prosody.im/
>minetest
https://www.luanti.org/en/
图片: https://i.4cdn.org/g/1785368546878022.jpg
↳ #2 No.109406241
Anonymous · 2026-07-29 23:44
>>109406230
Luau mogs it.
Luau 把Lua甩在了身后。
↳ #3 No.109406247
Anonymous · 2026-07-29 23:44
More Lua Technology
更多关于Lua技术
>window manager
>窗口管理器
https://awesomewm.org
>nginx fork
>Nginx分支
https://openresty.org/
>LuaJIT
https://luajit.org/
>libuv backend like nodejs
>类似Node.js的libuv后端
https://luvit.io/
>package manager
>软件包管理器
https://luarocks.org
↳ #4 No.109406250
Anonymous · 2026-07-29 23:44
>>109406230
I enjoyed it.
我很喜欢。
↳ #5 No.109406252
Anonymous · 2026-07-29 23:45
maid luachan is cute
Maid Luachan很可爱
↳ #6 No.109406265
Anonymous · 2026-07-29 23:47
>>109406241
!! IMPORTANT INFORMATION !!
Lua doesn't belong to legotroons. Legotroons gave up their right to associate with Lua.
Lua不属于LegoTroons(乐高迷/乐高玩家)。乐高迷们已经丧失了与Lua关联的权利。
Especially now that they forked the language, Lua can STOP being associated with the kids lego game.
尤其是现在他们把语言分了叉,Lua可以停止与那款乐高儿童游戏产生关联了。
Thank you very much!
非常感谢!
↳ #7 No.109406269
Anonymous · 2026-07-29 23:48
>>109406252
This is correct, however, her name is Lua-tan
这是对的,不过她的名字是Lua-tan(露娅酱)
↳ #8 No.109406290
Anonymous · 2026-07-29 23:52
>>109406230
Fuck Lua. It's a shitty language.
去他妈的Lua。这是一种很烂的语言。
↳ #9 No.109406338
Anonymous · 2026-07-30 00:02
>>109406290
Name a better language.
说出一种更好的语言来。
↳ #10 No.109406456
Anonymous · 2026-07-30 00:21
>arrays start from fucking 1
>数组居然从他妈的 1 开始
↳ #11 No.109406474
Anonymous · 2026-07-30 00:23
>>109406456
actually everyone was doing it the retarded way all this time with 0
实际上,所有人一直以来都在用那种愚蠢的方式操作,也就是0
↳ #12 No.109406507
Anonymous · 2026-07-30 00:29
why do they break the ABI at every release?
为什么每次发布都破坏ABI(应用二进制接口)?
图片: https://i.4cdn.org/g/1785371390562300.png
↳ #13 No.109406524
Anonymous · 2026-07-30 00:33
>>109406474
it makes sense because
这很合理,因为
thing[5]
5[thing]
thing+5
5+thing
are the same
是相同的
but thing+1 referring to thing makes no sense whatsoever
但是用thing+1来引用thing完全没有任何道理
↳ #14 No.109406531
Anonymous · 2026-07-30 00:33
>>109406338
Squirrel (the VM is not that good)
Squirrel(这个虚拟机效果没那么好)
Neko
Ruby
↳ #15 No.109406547
Anonymous · 2026-07-30 00:35
↳ #16 No.109406560
Anonymous · 2026-07-30 00:37
>>109406524
It works great if you store length in the first size_t.
如果你把长度存在第一个size_t里,它运行起来会很棒。
↳ #17 No.109406575
Anonymous · 2026-07-30 00:39
>>109406456
other than making circular buffers annoying, it's really not that big of a deal
除了让环形缓冲区变得烦人之外,这真的不是什么大事
↳ #18 No.109406582
Anonymous · 2026-07-30 00:40
>>109406524
In a 1-indexed array, when there are 5 values, thing[5] is the 5th value. When there is 1 value, thing[1] is the first and only value. When there are zero values, thing[0] is nothing, which is mathematically correct.
在一个1起始索引的数组中,当有5个值时,thing[5]是第5个值。当有1个值时,thing[1]是第一个也是唯一的值。当有0个值时,thing[0]什么都没有,这在数学上是正确的。
In a zero-indexed array with a length of 1, the element is t[length-1] aka 0. With a length of 0, what does that become? t[-1]? That's pretty homosexual.
对于长度为1的从零开始索引的数组,元素是t[length-1]也就是t[0]。长度为0的话,那会变成什么?t[-1]?这真够扯淡的。
↳ #19 No.109406585
Anonymous · 2026-07-30 00:40
being bothered by 1-indexed arrays is brainlet tier, it takes a minute to get used to
对基于1的数组索引感到困扰简直是弱智行为,适应一下也就一秒钟的事。
↳ #20 No.109406586
Anonymous · 2026-07-30 00:41
>>109406547
Fine. Lua is best friends forever with Lisp though
行吧。不过Lua和Lisp确实是永远的铁哥们。
↳ #21 No.109406592
Anonymous · 2026-07-30 00:42
>>109406582
>which is mathematically correct.
>这在数学上是正确的。
in the ZFC suburb of mathematics. we don't use that gay shit here.
在数学的ZFC郊区是这样的。我们这儿不用这种gay shit。
↳ #22 No.109406595
Anonymous · 2026-07-30 00:42
>>109406507
use luajit. call libraries via ffi directly without lua version dependent nonsense.
用luajit。通过ffi直接调用库,省去那些跟Lua版本绑定的废话。
↳ #23 No.109406655
Anonymous · 2026-07-30 00:52
>>109406230
luatan smells like raisins
luatan闻起来像葡萄干
↳ #24 No.109406715
Anonymous · 2026-07-30 01:01
↳ #25 No.109406726
Anonymous · 2026-07-30 01:02
>>109406715
janet is better
janet更好
↳ #26 No.109407163
Anonymous · 2026-07-30 02:35
Lua is excellent for working with AI. Talking about Lua with AI is very rewarding.
Lua非常适合和AI打交道。跟AI聊Lua非常有回报。
图片: https://i.4cdn.org/g/1785378919185997.png
↳ #27 No.109407179
Anonymous · 2026-07-30 02:37
Lua is perhaps the most comfy programming language of all time
Lua可能是有史以来最让人舒适的编程语言
图片: https://i.4cdn.org/g/1785379066932561.png
↳ #28 No.109407187
Anonymous · 2026-07-30 02:38
↳ #29 No.109407191
Anonymous · 2026-07-30 02:40
Lua is good for you, it heals the soul and strengthens the mind.
Lua对你有好处,它能治愈灵魂并强健心智。
图片: https://i.4cdn.org/g/1785379202318034.png
↳ #30 No.109407194
Anonymous · 2026-07-30 02:41
mnhoooooooohhhhhhhh!!!!!!!
呜哈哈哈哈吼吼吼吼吼吼吼吼吼吼吼吼!!!
图片: https://i.4cdn.org/g/1785379267535783.png
↳ #31 No.109407240
Anonymous · 2026-07-30 02:51
> anthropomorphizing programming languages into "cute anime girls"
>把编程语言拟人化成“可爱的动漫少女”
what a bunch of fucking losers, probably also pedophiles, lmao
这帮该死的失败者, probably也是恋童癖,哈哈
↳ #32 No.109407304
Anonymous · 2026-07-30 03:07
>>109407240
go back faggot.
滚回去,废物。
↳ #33 No.109407314
Anonymous · 2026-07-30 03:11
>>109407163
>Lua-tan prepending "TypeError:" to an error message
>Lua-tan在错误信息前面加上“TypeError:”
She would never do this.
她绝不会这么做。
↳ #34 No.109407330
Anonymous · 2026-07-30 03:13
>>109407163
>>109407179
>>109407187
>>109407191
>AI didn't understand the point of the original comment is that Lua-tan IS brazillian
>AI没明白原评论的意思,即Lua-tan就是个巴西婊
↳ #35 No.109407525
Anonymous · 2026-07-30 04:01
>>109406524
It only makes sense if your arrays are also pointers like C
只有当你的数组像C语言那样也是指针时,这才有意义
↳ #36 No.109407802
Anonymous · 2026-07-30 05:00
>>109406230
sovl
>>109407163
>>109407179
>>109407187
>>109407191
>>109407194
sovlless
↳ #37 No.109408475
Anonymous · 2026-07-30 08:32
>>109406230
Yes, just don't forget it's a scripting language. For something big or complex it's hard to use.
是的,只是别忘了它是一种脚本语言。对于大型或复杂的东西来说,它很难使用。
↳ #38 No.109408722
Anonymous · 2026-07-30 09:39
>>109406230
At what point in college do I learn when to use a scripting language?
我在大学的哪个阶段能学到什么时候该用脚本语言?
↳ #39 No.109408947
Anonymous · 2026-07-30 10:31
>>109406474
Arrays starting at 1 makes any math on them retarded. Especially flattening multidimensional arrays to 1D and back, which is common in game dev where Lua is used the most.
数组从1开始会让所有的数学运算都变弱智。特别是将多维数组展平为一维再还原回去,这在最常用Lua的游戏开发中很常见。
↳ #40 No.109409063
Anonymous · 2026-07-30 10:56
>>109406456
>>109408947
The problem is that no matter what you pick as the first index, there will be math that is inconvenient, the justifications people like you come up with for 0-indexing are mostly confabulations to justify why one is better AKA baby duck syndrome. In reality all starting indices are bad.
问题在于,无论你把起始索引定为多少,总有一些数学运算会变得不便。你们这类人为了支持0索引而提出的理由大多是事后找补的借口,也就是所谓的“小白鸭综合征”。实际上,所有起始索引都很烂。
>you want to represent a range of numbers from -10 to 10
>你想表示从-10到10的数字范围
>should arrays start at [-10]?
>数组应该从[-10]开始?
See the problem?
看到问题所在了吗?
>I have 5 apples
>我有5个苹果
>what is the Nth apple?
>第N个苹果是什么?
With 1-indexing, the math here makes sense because there is no 0th apple, so obviously the position 0 should contain nothing. Only positions 1 through 5 should contain a value, and having to do n-1 is retarded.
使用1索引时,这里的数学运算是有意义的,因为没有第0个苹果,所以位置0显然应该为空。只有位置1到5应该包含值,而不得不做n-1运算真是弱智。
But if the question is
但如果问题是
>how far away is the nearest apple from me on a 1-dimensional plane with 20 slots?
>在我面前一个有20个槽位的1维平面上,离我最近的苹果有多远?
Then obviously a C-style array makes more sense, but that is arbitrary, there's an infinite amount of math questions that don't make sense with 0-indexed arrays too.
那么显然C风格的数组更合理,但这也是随意的,也有无穷无尽的数学问题不适合0索引的数组。
That's why in Lua, tables are NOT ARRAYS, they are generic lookup tables that can contain any number of mixed key/value pairs, and numeric indices are just represented with an component internally as an optimization detail. You can literally initialize a Lua table however you want.
这就是为什么在Lua中,表(table)不是数组,它们是通用的查找表,可以包含任意数量的混合键值对,而数字索引只是在内部表示为一种优化细节。你可以随心所欲地初始化Lua表。
>for i = -10, 10 do tbl[i] = 0 end
> for i = -10, 10 tbl[i] = 0 结束
Now you have an "array" from -10 to 10, congrats.
现在你有了一个从 -10 到 10 的“数组”,恭喜。
Counting style indices where the Nth object is accessed with tbl[n] and tbl[#tbl] is the final object is a completely sane default that makes sense in most cases, and is only atypical for programming languages because of conventions.
采用第 N 个对象通过 tbl[n] 访问、tbl[#tbl] 表示最后一个对象的这种计数风格索引,是一个在大多数情况下都合理且正常的默认设计;它之所以在编程语言中显得“不典型”,仅仅是因为惯例问题。
This is why Lua is superior, don't post here ever again
这就是 Lua 更优越的原因,别再回来发帖了
↳ #41 No.109409129
Anonymous · 2026-07-30 11:10
>>109406230
>Lua is a powerful
>Lua 是一门功能强大的
No
>, efficient
>高效
No
>, lightweight
>轻量
No
>, embeddable scripting language.
>可嵌入的脚本语言。
Yes :)
↳ #42 No.109409156
Anonymous · 2026-07-30 11:17
>>109406230
Soft cuddly sex with this luady
和这位“露女士”来场柔软的亲密爱爱吧
↳ #43 No.109409218
Anonymous · 2026-07-30 11:35
>>109409063
I don't know the math but people confusing 'index 0' and '0th' is just sad. Maybe we should switch to indexing being done as `[1st, 2nd, ...]` so brainlets can keep up
我不知道什么数学理论,但人们搞混“索引 0”和“第 0 项”真是太可悲了。也许我们应该改用 `[第1项, 第2项, ...]` 的索引方式,好让那些脑残粉能跟上节奏
↳ #44 No.109409284
Anonymous · 2026-07-30 11:51
>>109407330
Post original pls
请发原帖
↳ #45 No.109409581
Anonymous · 2026-07-30 12:45
People's annoyed reactions to ai slop are always delicious
人们对 AI 生成垃圾的恼怒反应总是那么令人愉悦
↳ #46 No.109409609
Anonymous · 2026-07-30 12:52
>>109409218
Index 0 is the 0th entry when indices start at 1
当索引从 1 开始时,索引 0 就是第 0 项
↳ #47 No.109409622
Anonymous · 2026-07-30 12:54
>>109409129
It's all 4 of those things, but
这四点它都具备,但是
>Lua is not lightweight
>Lua 并不轻量
retard
↳ #48 No.109409999
Anonymous · 2026-07-30 14:01
>>109409063
>The problem is that no matter what you pick as the first index
>问题在于,无论你把哪个选作起始索引
0 indexed arrays do not cause mathematical problems.
0 起始索引的数组并不会导致数学问题。
>the justifications people like you come up with for 0-indexing are mostly confabulations to justify why one is better AKA baby duck syndrome
>你们这种人为了 0 起始索引找出的理由,大多数都是为了证明为什么它更好而编造的托辞,也就是“小鸭子综合征”
Just because you can't comprehend my previous post doesn't mean it's a confabulation.
仅仅因为你无法理解我之前的帖子,并不代表那是编造出来的。
Another case where it is a problem is modulo arithmetic. Every time you want to wrap around the array you need to add and remove 1 in the same equation.
另一个出现问题的情况是模运算。每次你想让数组循环时,都需要在同一个方程里进行加减 1 的操作。
>>you want to represent a range of numbers from -10 to 10
>>你想表示一个从 -10 到 10 的数字范围
>>should arrays start at [-10]?
>>数组就应该从 [-10] 开始吗?
A range of numbers should be represented by two numbers, start and end, not by an array.
数字范围应该由两个数字表示:起始值和结束值,而不是通过数组来表示。
>>I have 5 apples
>>我有 5 个苹果
>>what is the Nth apple?
>>第 N 个苹果是哪个?
The Nth apple is apples[n]
第 N 个苹果就是 apples[n]
>>how far away is the nearest apple from me on a 1-dimensional plane with 20 slots?
>>在一个有 20 个槽位的 1 维平面上,离我最近的苹果有多远?
Define far away metric and a slot
定义一下“远”的度量标准以及“槽位”
>there's an infinite amount of math questions that don't make sense with 0-indexed arrays too.
>用 0 起始索引的数组,存在无数多没意义的数学问题。
You are yet to provide any.
你还没提供任何例子。
>Now you have an "array" from -10 to 10,
>现在你有了一个从 -10 到 10 的“数组”,
That's a range, not an array.
那是一个范围,不是数组。
>This is why Lua is superior
>这就是 Lua 更优越的地方
You are yet to prove that.
你还没证明这一点。
↳ #49 No.109410159
Anonymous · 2026-07-30 14:28
>>109409999
Stopped reading this post after the fist line kek
看到第一句我就不想再看下去了,哈哈
↳ #50 No.109410279
Anonymous · 2026-07-30 14:48
>>109406230
Trans thread fuck off
跨帖翻译滚粗
↳ #51 No.109410494
Anonymous · 2026-07-30 15:23
↳ #52 No.109410574
Anonymous · 2026-07-30 15:33
>>109406230
Nothing personnel, but Lua is shit.
没有私人恩怨,但 Lua 就是垃圾。
Get a real language, kiddo.
学门正经语言吧,小屁孩。
↳ #53 No.109410688
Anonymous · 2026-07-30 15:50
Lua is comfy and cute language to use. It's beginner friendly and it would be ideal if arrays didn't start at 1
Lua 是一门用起来很舒服、很可爱的语言。它对初学者很友好,如果数组不从 1 开始就完美了
↳ #54 No.109410710
Anonymous · 2026-07-30 15:54
>>109409999
>A range of numbers should be represented by two numbers, start and end, not by an array.
>数字范围应该由两个数字表示:起始值和结束值,而不是通过数组来表示。
I think you meant to say three anon. Also depending on the type of numbers it's nice to have them in an array. Let's say I got an array with the fibonacci numbers calculated to n. If I want to know the mth and lth fibonacci (while m, l <= n) I don't need to calculate them until m or l but instead just check the index[m-1] or index[l-1]. Additionally it's one calculation less if I have a series of numbers which are not dependent on each other (like multiples of five).
我想你应该是想说三个匿名者吧。此外,取决于数字的类型,把它们放在数组里是很方便的。假设我有一个计算到第 n 项的斐波那契数列数组。如果我想找第 m 项和第 l 项的斐波那契数(且 m, l <= n),我不需要从头计算直到 m 或 l,而是直接查看 index[m-1] 或 index[l-1] 即可。另外,如果是一系列互不依赖的数字(比如 5 的倍数),这样还能少一次计算。
>The Nth apple is apples[n]
>第N个苹果是apples[n]
Not under 0-indexing unless you use 0 as an index an just never use it, truly the worst of both worlds.
除非你采用0起始索引,然后使用0作为索引却永远不用它,这真的是两败俱伤的最烂做法。
Pedantics aside: 0 indexing good because standard
撇开那些咬文嚼字的不说:0起始索引好,因为这是标准。
↳ #55 No.109410740
Anonymous · 2026-07-30 15:58
↳ #56 No.109410760
Anonymous · 2026-07-30 16:01
>>109410710
>I think you meant to say three anon
>我想你是想说三位匿名者吧
No. A numerical range should be represented by two numbers and maybe some extra flags that tells you whenever the bounds are inclusive or exclusive or unbounded.
不对。数值范围应该用两个数字表示,可能再加上一些额外的标志位,用来指明边界是包含还是排除,或者是无界的。
>Also depending on the type of numbers it's nice to have them in an array.
>此外,根据数字类型的不同,把它们存进数组里挺好的。
There is no reason to store range in an array. Especially if you are dealing with floating point numbers as storing all 32-bit floating point numbers in 0-1 range(inclusive) would require 1065353215 long array.
没理由把范围存在数组里。特别是当你处理浮点数时,如果要存储0到1范围(含边界)内所有的32位浮点数,需要一个包含1065353215个元素的长数组。
>If I want to know the mth and lth fibonacci (while m, l <= n) I don't need to calculate them until m or l but instead just check the index[m-1] or index[l-1].
>如果我想求第m个和第l个斐波那契数(假设m, l <= n),我不需要一直计算到第m或第l个,而是直接查index[m-1]或index[l-1]。
That's not a range. That's a lookup table.
那不叫范围。那叫查找表。
>Additionally it's one calculation less if I have a series of numbers which are not dependent on each other (like multiples of five).
>另外,如果我有一组互不依赖的数字(比如5的倍数),这样可以少算一次。
If you want to get a multiply of five you do 5*n, no need for any array.
如果你想获取5的倍数,直接算5*n就行,根本不需要任何数组。
↳ #57 No.109410806
Anonymous · 2026-07-30 16:08
Learning fennel, because it seems neat. I have no idea what to use it for, though.
正在学Fennel,因为它看起来很整洁。不过我不知道该用它来干嘛。
↳ #58 No.109410808
Anonymous · 2026-07-30 16:08
>>109410760
>A numerical range should be represented by two numbers and maybe some extra flags that tells you whenever the bounds are inclusive or exclusive or unbounded.
>数值范围应该用两个数字表示,可能再加上一些额外的标志位,用来指明边界是包含还是排除,或者是无界的。
Steps
>There is no reason to store range in an array
>没理由把范围存在数组里
Already gave you an example
我已经给你举过例子了
>That's not a range. That's a lookup table.
>那不叫范围。那叫查找表。
Wrong, it's the range of fib(n) which starts with the first fibonacci number and then goes on to n. What you think of as a range is actually yet another function in which func(x) = 1 + 1 + ... + 1 for x times.
错了,这是fib(n)的范围,它从第一个斐波那契数开始,一直延续到第n个。你以为的“范围”实际上还是另一个函数,即func(x) = 1 + 1 + ... + 1(共x次)。
>If you want to get a multiply of five you do 5*n, no need for any array.
>如果你想获取5的倍数,直接算5*n就行,根本不需要任何数组。
And I already told you in which case you'd like to not do that. I can give you another example too:
我早就告诉过你什么时候你不该那样做。我也可以再给你举个例子:
I recently created a list in which I stored a book's first actual page with content and it's last corresponding page, when I'd start to read it, when I intend to be finished. By that I calculated a ratio of pages/day. I don't care much about the ratio but instead where I want to be on a given day. So I made an array which is just ratio * days since the beginning - 1. It makes no sense for me to recalculate it each time, that little ram I can waste.
我最近创建了一个列表,存储了一本书从第一页有效内容开始到最后一页对应的页数,以及我打算开始阅读和预计读完的日期。通过那个我计算了每天的页数比例。其实我不太在意比例,我更关心的是在特定日期我应该读到哪一页。所以我做了一个数组,内容只是比例乘以自开始以来的天数减1。每次重新计算对我来说没意义,这点内存浪费一下也无所谓。
↳ #59 No.109410938
Anonymous · 2026-07-30 16:29
>>109410806
>he thought learning a lisp would be useful
>他觉得学Lisp会很有用
↳ #60 No.109410955
Anonymous · 2026-07-30 16:30
>>109406582
Subzero IQ post.
零智商发言。
↳ #61 No.109410964
Anonymous · 2026-07-30 16:31
>>109410808
>>A numerical range should be represented by two numbers and maybe some extra flags that tells you whenever the bounds are inclusive or exclusive or unbounded.
>>数值范围应该用两个数字表示,可能再加上一些额外的标志位,用来指明边界是包含还是排除,或者是无界的。
>Steps
Steps, as in difference between a number and it's successor in a numeric range comes naturally from the underlying number group. For integers that will be 1, for real numbers there is no successors and for floats that will depend on the distance from 0. There is no reason to store it.
步长,即数值范围内一个数与其后继数之间的差值,自然地源于底层的数字群。对于整数来说是1,对于实数来说没有后继数,而对于浮点数则取决于距离0的远近。没理由把它存起来。
>Already gave you an example
>已经给你举过例子了
So far you've only talked about some lookup tables and storing numerical ranges in arrays.
到目前为止,你只提到了查找表和把数值范围存在数组里。
>>That's not a range. That's a lookup table.
>>那不叫范围,那是个查找表。
>Wrong
You said:
你说过:
>Let's say I got an array with the fibonacci numbers calculated to n
>假设我有一个数组,里面存着算到第 n 项的斐波那契数列
That sounds very like a precomputed lookup table.
这听起来非常像预计算的查找表。
>What you think of as a range is actually yet another function
>你所谓的“范围”其实是另一个函数
What's a range depends on how you model it, but generally you just need a start and end if you are talking about totally ordered field like real numbers.
“范围”是什么取决于你的建模方式,但一般来说,如果你说的是实数这类全序域,你只需要一个起点和一个终点。
>func(x) = 1 + 1 + ... + 1
函数 f(x) = 1 + 1 + ... + 1
That looks like a diverging function.
这看起来是个发散的函数。
>And I already told you in which case you'd like to not do that.
>我早就告诉过你在什么情况下不该那样做了。
I must have missed it and it's incredibly hard to visualize an example where lookup table would be better choice than just multiplying a number by 5.
我可能漏看了,而且我完全想不出什么例子会让查找表比直接把数字乘以 5 更合适。
>I recently created a list in which I stored a book's first actual page with content and it's last corresponding page, when I'd start to read it, when I intend to be finished. By that I calculated a ratio of pages/day. I don't care much about the ratio but instead where I want to be on a given day. So I made an array which is just ratio * days since the beginning - 1
>我最近创建了一个列表,里面存了每本书实际有内容的第一页和对应的最后一页,也就是我开始读的那一页和我计划读完的那一页。根据这个我计算了每天的页数比例。其实我不太在意这个比例,我更关心的是在特定日期我应该读到哪。所以我弄了个数组,其实就是 比例 * 从开始算起的天数 - 1
That sounds like a bad, bug-prone code. Now you are introducing unnecessary invariants and state that you must keep synced every time you want to change one of them. If someone or even you in future revisit that code, unless they read carefully through documentation, they might be confused on what is actually source of truth and introduce invalid state.
这听起来像是有 bug、容易出错的代码。你现在引入了不必要的不变量和状态,每次改其中一个时都必须确保它们同步。如果以后有人(甚至是你自己)回来改这段代码,除非他们仔细阅读了文档,否则他们可能会搞不清真正的“真相来源”是什么,从而引入无效状态。
↳ #62 No.109411028
Anonymous · 2026-07-30 16:38
>>109406547
>>109406586
>Semantically, Lua has many similarities with Scheme, even though these similarities are not immediately clear because the two languages are syntactically very different. The influence of Scheme on Lua has gradually increased during Lua’s evolution: initially, Scheme was just a language in the background, but later it became increasingly important as a source of inspiration, especially with the introduction of anonymous functions and full lexical scoping.
>语义上,Lua 和 Scheme 有很多相似之处,尽管因为这两种语言的语法差异很大,这些相似之处并不一目了然。Scheme 对 Lua 的影响随着 Lua 的发展逐渐加深:起初,Scheme 只是背景中的一项技术,但后来它作为灵感来源变得越来越重要,尤其是在引入匿名函数和完整的词法作用域之后。
https://www.lua.org/doc/hopl.pdf
图片: https://i.4cdn.org/g/1785429516887021.png
↳ #63 No.109411065
Anonymous · 2026-07-30 16:42
>>109410964
>There is no reason to store it.
>没必要存它。
Except for when you need a range of numbers and each one is separated by exactly the same length.
除非你需要一串数字,而且每个数字之间的间距完全一样。
>So far you've only talked about some lookup tables and storing numerical ranges in arrays.
>到目前为止,你只提到了查找表和把数值范围存在数组里。
I've given you an example in which storing in an array is more logical than calculating the number at a given index.
我已经给了你一个例子,说明在那种情况下存成数组比通过公式计算给定索引的值更合理。
>That sounds very like a precomputed lookup table.
>这听起来非常像预计算的查找表。
That is a range.
这就是个范围。
>What's a range depends on how you model it, but generally you just need a start and end if you are talking about totally ordered field like real numbers.
>“范围”是什么取决于你的建模方式,但一般来说,如果你说的是实数这类全序域,你只需要一个起点和一个终点。
And the rules for that ordering need to be known too. The way you think of a range excludes everything that isn't just real numbers.
而且排序的规则也必须是已知的。你那种对“范围”的理解排除了所有非实数的情况。
>I must have missed it
>我可能漏看了
Weird because you tried to respond to it.
很奇怪,因为你似乎试着回复过那段内容。
>they might be confused
>他们可能会感到困惑
Anon, it's four variables per book. It takes a single line comments to understand the code that I haven't shared with anyone. What's worse is that it's a perfectly sensible approach and if you disagreed you'd already have proposed a better 'solution'.
匿名,每本书对应四个变量。只需一行注释就能让我理解那些我没分享给别人的代码。更糟糕的是,这其实是个完全合理的方案,如果你不认同,你早就提出更好的“解决方案”了。
↳ #64 No.109411163
Anonymous · 2026-07-30 16:55
>>109411065
>Except for when you need a range of numbers and each one is separated by exactly the same length.
>除非你需要一串数字,且每个数字之间间隔完全相同。
That's not a range, that's an arithmetic sequence.
那不叫区间,那叫等差数列。
>I've given you an example in which storing in an array is more logical than calculating the number at a given index.
>我给了你一个例子,说明用数组存储比计算给定索引处的数值更符合逻辑。
Your example argued for precomputing fibonacci numbers, not numerical ranges.
你的例子主张的是预计算斐波那契数列,而不是数值区间。
>That is a range.
>这就是个区间。
An array containing results of expensive calculation is a lookup table.
包含昂贵计算结果的数组就是个查找表。
>In computer science, a lookup table (LUT) is an array that replaces runtime computation of a mathematical function with a simpler array indexing operation, in a process termed as direct addressing.
>在计算机科学中,查找表(LUT)是一个数组,它用更简单的数组索引操作替换了数学函数的运行时计算,这个过程称为直接寻址。
Now, mathematical range, also called interval:
现在,数学上的区间(interval):
>In mathematics, an interval is the set of all real numbers lying between two fixed endpoints with no "gaps". For example, the set of real numbers consisting of 0, 1, and all numbers in between is an interval, denoted [0, 1] and called the unit interval. An interval may contain neither endpoint (called an open interval), both endpoints (called a closed interval), or either endpoint (called a semi-open or semi-closed interval).
>在数学中,区间是指两个固定端点之间所有实数的集合,中间没有“空隙”。例如,由 0、1 以及它们之间所有数组成的实数集就是一个区间,记作 [0, 1],称为单位区间。区间可能不包含端点(称为开区间),包含两个端点(称为闭区间),或只包含其中一个端点(称为半开或半闭区间)。
>And the rules for that ordering need to be known too.
>而且这些排序的规则也需要被知晓。
Ordering is given by the algebraic field itself too.
排序本身由代数域就已经规定了。
>The way you think of a range excludes everything that isn't just real numbers.
>你对区间的理解排除了所有非实数的东西。
No, ranges can be generalized to other fields https://en.wikipedia.org/wiki/Interval_(mathematics)#Generalizations and of course to subgroups like integers.
>Weird because you tried to respond to it.
>这很奇怪,因为你试图回应它。
Point to it then.
指出来给我看看。
>it's four variables per book.
>每本书四个变量。
For now. As you software starts growing, new values might be introduced and the spaghetti of invariants can lead to a lot of troubles refactoring.
目前是这么回事。但随着你的软件逐渐壮大,可能会引入新值,而这些不变量的“意大利面条式”纠缠会在重构时带来很多麻烦。
>if you disagreed you'd already have proposed a better 'solution'.
>如果你不认同,你早就提出更好的“解决方案”了。
Solution is simple. Normalization and single source of truth. Memoization should be reserved for computationally complex operations done within hot loops.
解决方案很简单。规范化,并保证单一数据源。记忆化(Memoization)应仅保留给热点循环中那些计算密集型的操作。
↳ #65 No.109411856
Anonymous · 2026-07-30 18:44
I'm not reading your autism war posts but I'm betting on the non reddit spacer
我不打算读你那篇关于自闭症战争的文章,但我押注那个非 Reddit 用户(指间隔符用户)
↳ #66 No.109411881
Anonymous · 2026-07-30 18:48
>>109411856
Thanks, he wanted to devolve it to semantics
谢了,他本想把它降级为语义之争
↳ #67 No.109412813
Anonymous · 2026-07-30 20:45
>>109410938
It’s not a lisp problem. It happens every time I try learning a new language. Once I get the basics down, I have no idea what to do with it.
这不是 Lisp 的问题。每次我尝试学新语言时都会发生这种情况。一旦掌握了基础,我就不知道该怎么用它了。
↳ #68 No.109412955
Anonymous · 2026-07-30 21:04
>>109406241
>Faster Lua with types
>带类型系统的更快 Lua
:D
>Slowly bastardizing it into a amalgalanguage like C++
>慢慢地把它腐蚀成像 C++ 那样的大杂烩语言
D:
Even Mike Pall is planning on doing stuff like this. I know Lua itself has some glaring design mistakes/oversights, but now you're just multiplying it into an even bigger, fragmented mess.
连 Mike Pall 都打算搞这些玩意儿了。我知道 Lua 本身有一些明显的设计失误/疏忽,但你现在只是在把它变成一个更大、更支离破碎的烂摊子。
图片: https://i.4cdn.org/g/1785445484126693.png
↳ #69 No.109413000
Anonymous · 2026-07-30 21:11
↳ #70 No.109414752
中出し · 2026-07-31 02:01
>>109410740
War is to man what maternity is to a woman.
战争之于男人,正如生育之于女人。
图片: https://i.4cdn.org/g/1785463288163388.jpg
↳ #71 No.109414758
Anonymous · 2026-07-31 02:03
>>109406230
If a language wasn't written by a white man you shouldn't use it.
如果一个语言不是白人写的,你就不该用它。
图片: https://i.4cdn.org/g/1785463423482139.jpg
↳ #72 No.109414771
Anonymous · 2026-07-31 02:06
>>109414758
so is it safe to use english?
那用英语安全吗?
↳ #73 No.109415578
Anonymous · 2026-07-31 04:19
>>109414758
Brazilian men are honorary white men
巴西男人算名誉白人。
↳ #74 No.109417168
Anonymous · 2026-07-31 08:55
>>109414771
Came from the germans so yeah
来自德国人,所以算吧。
↳ #75 No.109417221
Anonymous · 2026-07-31 09:09
↳ #76 No.109417828
Anonymous · 2026-07-31 11:22
↳ #77 No.109418111
Anonymous · 2026-07-31 12:23
Anons, have you heard of lua-moses
匿名们,你们听说过lua-moses吗?
https://github.com/Yonaba/Moses
↳ #78 No.109418259
Anonymous · 2026-07-31 12:48
>>109418111
If you like functional programming, I don't see why you would use this, why pick Lua at all?
如果你喜欢函数式编程,我真不懂你为什么用这个,为啥选Lua?
↳ #79 No.109418622
Anonymous · 2026-07-31 13:44
↳ #80 No.109418925
Anonymous · 2026-07-31 14:35
↳ #81 No.109419046
Anonymous · 2026-07-31 14:52
>>109414758
lua is whiter than jeetscript
Lua比阿三脚本白多了。
t. dotnet core user
出自dotnet core用户之口。
↳ #82 No.109419994
Anonymous · 2026-07-31 16:57
>>109419046
>t. dotnet core user
>出自dotnet core用户之口。
You're Indian so you have no idea as to what 'whiteness' is
你是印度人,所以你根本不了解“白”是什么。
↳ #83 No.109420286
Anonymous · 2026-07-31 17:26
>>109406456
this, and also the lack of real arrays and lack of integers, what a shitshow
同意,而且还没有真正的数组和整数,真是个烂摊子。
↳ #84 No.109420736
Anonymous · 2026-07-31 18:12
>>109420286
Erm acktually, Lua numeric tables are real arrays in both PUC Lua in LuaJIT.
嗯,实际上,Lua的数值表在PUC Lua和LuaJIT里都是真正的数组。
Lua also has real 64-bit integers.
Lua也有真正的64位整数。
↳ #85 No.109420980
Anonymous · 2026-07-31 18:40
>>109420736
>Erm acktually, Lua numeric tables are real arrays in both PUC Lua in LuaJIT.
>嗯,实际上,Lua的数值表在PUC Lua和LuaJIT里都是真正的数组。
It doesn't, it uses arrays internally has as optimization if you used tables in a very narrow way.
不是的,它只是在内部用数组做优化,如果你以很窄的方式用表的话。
>Lua also has real 64-bit integers.
>Lua也有真正的64位整数。
Only since a recent version and even if you can be sure that an integer is what some variable contains, the language is not built for it. For almost all its life that manual said "Lua has no integer types and do not need it."
那是最近版本才有的,就算你能确定变量里的值是整数,这门语言也不是为这设计的。在它几乎整个生命周期里,手册都说“Lua没有整数类型,也不需要。”
Just admit I'm right, those are aspects where Lua fucking sucks.
就承认我对了吧,这些方面Lua确实烂透。
↳ #86 No.109420995
Anonymous · 2026-07-31 18:41
>>109420980
>For almost all its life that manual said "Lua has no integer types and do not need it."
>在它几乎整个生命周期里,手册都说“Lua没有整数类型,也不需要。”
Yeah in PIL 2003, kek
对,2003年的PIL,呵呵。
↳ #87 No.109421003
Anonymous · 2026-07-31 18:42
>>109420980
luajit jits out integer math if you use numbers as integers, same as javascript really.
luajit 在把数字当整数用时会把整数数学 JIT 掉,其实跟 JavaScript 一样。
↳ #88 No.109421013
Anonymous · 2026-07-31 18:44
>>109420980
>Just admit I'm right, those are aspects where Lua fucking sucks.
>就承认我对了吧,那些方面 Lua 真是烂透了。
they don't suck, you're just retarded is all
不烂,你只是蠢而已,就这。
↳ #89 No.109422778
Anonymous · 2026-07-31 22:08
↳ #90 No.109422990
Anonymous · 2026-07-31 22:29
>>109421013
premium cope right there
教科书级别的嘴硬。
↳ #91 No.109423148
Anonymous · 2026-07-31 22:51
>>109419994
>no ur indian
>不,你是印度人。
Found expressjeet dev
找到 expressjeet 开发者了。
图片: https://i.4cdn.org/g/1785538300238461.png
↳ #92 No.109423173
Anonymous · 2026-07-31 22:54
Lua should not exist.
Lua 就不该存在。
↳ #93 No.109423202
Anonymous · 2026-07-31 22:58
Lua should exist
Lua 应该存在。
↳ #94 No.109423389
Anonymous · 2026-07-31 23:25
Lua should not have been massively adopted.
Lua 就不该被大规模采用。
>Worse it better.
>越烂越好。
↳ #95 No.109423468
Anonymous · 2026-07-31 23:37
>>109423389
Lua was a mistake
Lua 是个错误。
↳ #96 No.109423902
Anonymous · 2026-08-01 00:36
Lua and its consequences have been a disaster for the human race.
Lua及其后果对人类来说是场灾难。
↳ #97 No.109423975
Anonymous · 2026-08-01 00:48
Lua was cute while it lasted.
Lua好看的时候还是挺可爱的。
↳ #98 No.109424016
Anonymous · 2026-08-01 00:53
>>109423173
>>109423389
>>109423902
true saars
确实如此
lua is unredeemable mess
Lua是个无可救药的烂摊子
python is the designated aryan brahmir language to redeem the world asap
Python才是被选中的雅利安婆罗门语言,用来赶紧拯救世界
图片: https://i.4cdn.org/g/1785545590048791.png
↳ #99 No.109424447
Anonymous · 2026-08-01 02:10
↳ #100 No.109426064
Anonymous · 2026-08-01 08:10
>>109423148
but code is perfect for gorgeous looks sir
但代码完美适合漂亮外观啊先生
↳ #101 No.109427489
Anonymous · 2026-08-01 13:01
>>109408722
now or never
机不可失
↳ #102 No.109429288
Anonymous · 2026-08-01 17:24
↳ #103 No.109431095
Anonymous · 2026-08-01 20:53
Are Python, Ruby, JavaScipt and Lua then end of scripting languages? What's next? What features should a modern scripting language made from scratch have? What use cases? String processing, embeddable language, more ? Which paradigms? Certainly, OOP should be a feature but it shouldn't be the most advanced one not the selling point.
Python、Ruby、JavaScript和Lua是脚本语言的终点吗?下一个是啥?一个从零开始的现代脚本语言该有哪些特性?哪些用例?字符串处理、可嵌入语言、还有啥?哪些范式?当然,OOP该有,但它不该是最先进的特性,也不该是卖点。
↳ #104 No.109431103
Anonymous · 2026-08-01 20:54
*nor the selling point
*也不该是卖点
↳ #105 No.109431268
Anonymous · 2026-08-01 21:19
>>109431095
>>109431103
The end of programming languages is a Lua dialect with no retarded global variable system, opt-in strict typing, const variables, a better module system, better anonymous function syntax (like JS arrow functions), ternary and safe navigation operators, better handling of integers, and a more capable standard library.
编程语言的终结是一种Lua方言,没有智障的全局变量系统,可选严格类型、常量变量、更好的模块系统、更好的匿名函数语法(像JS箭头函数那样)、三元和空安全操作符、更好的整数处理,以及更强大的标准库。
↳ #106 No.109431501
Anonymous · 2026-08-01 21:47
>>109427489
Ok so when do I use a scripting language? I genuinely have no clue
好吧,那我什么时候该用脚本语言?我真的完全没头绪
↳ #107 No.109432179
Anonymous · 2026-08-01 23:34
Cnile here, I like lua :)
这里是Cnile,我喜欢lua :)
↳ #108 No.109432188
Anonymous · 2026-08-01 23:36
>>109432179
>C
Lua löves you too
Lua也爱着你
↳ #109 No.109432195
Anonymous · 2026-08-01 23:37
>>109406230
Lua is nice, but Luau is peak
Lua不错,但Luau才是巅峰
↳ #110 No.109432210
Anonymous · 2026-08-01 23:39
>>109432195
Legotards are not welcome in this thread.
乐高傻逼们不许进本贴。
↳ #111 No.109432232
Anonymous · 2026-08-01 23:43
>>109432210
>brazilians getting mogged by a children games devs in their own language
>巴西人居然被儿童游戏开发者用他们自己的语言给碾压了
lmaooooo
↳ #112 No.109432267
Anonymous · 2026-08-01 23:48
>>109406247
>says awesomewm is the only WM with Lua configuration
>说awesomewm是唯一用Lua配置的窗口管理器
Guys have you every of something called Hyprland?
兄弟们你们听说过一个叫Hyprland的东西吗?
↳ #113 No.109432300
Anonymous · 2026-08-01 23:52
>>109432267
I didn't say that doe
我可没这么说啊
↳ #114 No.109434766
Anonymous · 2026-08-02 07:15
↳ #115 No.109435766
Anonymous · 2026-08-02 10:42
Anyone messed with lutro? Supposedly it's a compatibility thing that lets you play love2d games on something like retroarch, so you could put your game in any machine that runs retroarch
有人折腾过lutro吗?据说是个兼容层,能让你在类似retroarch的东西上跑love2d游戏,这样你的游戏就能在任意能跑retroarch的机器上玩
图片: https://i.4cdn.org/g/1785667346702658.png
↳ #116 No.109435801
Anonymous · 2026-08-02 10:48
>>109435766
It looks interesting but I don't see the point.
看起来挺有意思,但我觉得没啥意义
I don't know what I expected when I read "retroarch" but it just looks like it adds some extra api stuff to love that lets you use it with retroarch's controls.
读“retroarch”的时候我本来不知道会是什么样,但它看起来只是给love加了一些额外的api接口,让你能用retroarch的操控方式
I was thinking in my head it was going to convert it to some kind of retro game format
我心里想的是它会转换成某种复古游戏格式
Probably cool if you already have retroarch and you use it for most of your gayming though.
如果你已经有retroarch,而且大部分游戏都靠它玩,那可能挺酷的
↳ #117 No.109435823
Anonymous · 2026-08-02 10:53
>>109435801
so you can put the game on your phone or hacked console or whatever thing running it.
这样就能把游戏放到手机、破解主机或任何能跑它的设备上
↳ #118 No.109435831
Anonymous · 2026-08-02 10:54
>>109435823
Love2d already works on everything
love2d本来就能在什么上跑
You can literally put love2d on a nintendo 3ds. So you don't need some 3rd party thing.
你甚至可以把love2d装到任天堂3ds上,所以根本不需要第三方东西
↳ #119 No.109436974
Anonymous · 2026-08-02 13:58
Is Lua still used for WoW addons, like in 2010s?
Lua现在还在用于魔兽世界插件吗,就像2010年代那样?
↳ #120 No.109437029
Anonymous · 2026-08-02 14:07
>>109435766
it's only love2d-inspired, you still have to write against lutro directly.
那个只是受love2d启发,你还是得对着lutro直接写
but it's nice, having all the retroarch features like scaling, save and load, controller support and multiplatform for free.
但挺好的,自带retroarch那些功能,缩放、存档读档、手柄支持、多平台,全都免费
↳ #121 No.109438879
Anonymous · 2026-08-02 18:29
↳ #122 No.109438985
Anonymous · 2026-08-02 18:44
what a terrible thread
这帖子烂透了
use terra
用terra
↳ #123 No.109439419
Anonymous · 2026-08-02 19:35
>>109438985
what a terrible post.
这回复烂透了
use luajit.
用luajit
↳ #124 No.109442379
Anonymous · 2026-08-03 01:37
>>109438985
>arrays start at either 1 or 0 depending on the context
>数组下标根据情况从1或者0开始
KEK
↳ #125 No.109442601
Anonymous · 2026-08-03 02:12
inferior to micropython and BASIC
比不上micropython和BASIC ┘ 我恨自己居然认出了画这玩意儿那死基佬
图片: https://i.4cdn.org/g/1785723128621776.png
↳ #126 No.109442982
Anonymous · 2026-08-03 03:00
>>109411028
I hate that I recognized the faggot who drew this
我讨厌自己竟然认出了画这个的死基佬
↳ #127 No.109443197
Anonymous · 2026-08-03 03:26
>>109429288
Hmmmmmm
Several years ago I remember seeing a complete rewrite of SICP in Python
好几年前我记得看过一个SICP的Python全面重写版
The langugae has enough builtin functional programming concepts to make it possible
这语言自带够多的函数式编程概念所以搞得出来
I think Lua falls short
我觉得Lua差点意思
↳ #128 No.109443274
Anonymous · 2026-08-03 03:33
>>109406269
>her
I thought it was a man
我还以为是个男的
↳ #129 No.109444776
Anonymous · 2026-08-03 07:18
>>109443274
need gut-punches from Lua kun
需要Lua酱来直击心灵
↳ #130 No.109446873
Anonymous · 2026-08-03 12:46
↳ #131 No.109446960
Anonymous · 2026-08-03 12:59
↳ #132 No.109449580
Anonymous · 2026-08-03 17:54
>>109443197
>complete rewrite of SICP in Python
>SICP的Python全面重写版
Cursed
↳ #133 No.109449777
Anonymous · 2026-08-03 18:17
↳ #134 No.109449785
Anonymous · 2026-08-03 18:18
>>109406230
I like the way vintage story did it better.
我觉得vintage story那个做法更好。
There's really no need to interpret this shit at runtime and you can still have all the same benefits with C# with less headache of a usually dogshit IDE and game API experience
真没必要在运行时解释这破玩意,用C#也能拿到全部同样的好处,还不用受那种通常烂得一逼的IDE和游戏API体验的气
↳ #135 No.109452038
Anonymous · 2026-08-03 22:11
>>109449785
>vintage story
> 经典故事
???
↳ #136 No.109454860
Anonymous · 2026-08-04 03:50
>>109452038
it's a game with a modding system written in C#.
那是个用C#写模组系统的游戏。
the entire base game is literally a mod. Similar to Factorio, except factorio uses Lua.
整个本体游戏说白了就是个模组。跟异星工厂差不多,只不过异星工厂用的是Lua。
↳ #137 No.109455452
Anonymous · 2026-08-04 05:13
>>109454860
What does this have to do with Lua?
这跟Lua有啥关系?
↳ #138 No.109455489
Anonymous · 2026-08-04 05:20
>>109455452
C# does everything lua can do but better
C#能把Lua能干的事全干了而且干得更好
↳ #139 No.109455682
Anonymous · 2026-08-04 05:55
>>109455489
They are not even the same kind of programming language.
这俩压根就不是同一种类型的编程语言。
↳ #140 No.109455700
Anonymous · 2026-08-04 06:01
>>109455682
you can use them the same way
用起来倒是一回事
↳ #141 No.109456422
Anonymous · 2026-08-04 08:36
>>109455452
the real power of c# modmaking comes from libraries that allow to inject and redirect bytecode almost anywhere
C#模组制作真正的威力来自于那些几乎可以在任何地方注入和重定向字节码的库
you can't do that with lua and that's another reason why lua is a relic of the past
用Lua做不到这点,这也是为什么Lua是过时遗物的另一个原因
↳ #142 No.109456558
Anonymous · 2026-08-04 09:14
>>109456422
>you can't do that with lua
>用Lua做不到这点
Yeah you can
不,做得到
图片: https://i.4cdn.org/g/1785834846664745.jpg
↳ #143 No.109456580
Anonymous · 2026-08-04 09:19
↳ #144 No.109456615
Anonymous · 2026-08-04 09:32
↳ #145 No.109457207
Anonymous · 2026-08-04 11:42
>>109456422
what a silly comparison. if the whole game is written in lua you don't even need to bother with the bytecode to mod it.
这比较真蠢。如果整个游戏都是用Lua写的,你根本不用费劲搞字节码就能做模组。
btw, I'm modding a native win32 exe using luajit right now.
顺带一提,我现在正在用luajit给一个原生win32 exe做模组。
↳ #146 No.109457318
Anonymous · 2026-08-04 11:59
>>109457207
> if the whole game is written in lua you don't even need to bother with the bytecode to mod it
> 如果整个游戏都是用Lua写的,你根本不用费劲搞字节码就能做模组
1. that doesn't mean lua sources will be there, or you can edit and share them
1. 这不意味着Lua源码一定在,或者你能编辑和分享它们
2. multiple mods or injecting into another mod
2. 多个模组或者注入到另一个模组里
> I'm modding a native win32 exe using luajit right now
> 我现在正在用luajit给一个原生win32 exe做模组
says nothing
这啥也说明不了
↳ #147 No.109457375
Anonymous · 2026-08-04 12:06
>>109457318
>that doesn't mean lua sources will be there
>这不意味着Lua源码一定在
huh? in any reasonable scenario ther will be. if the author is hiding lua source in bytecode, it's obfuscating and preventing modding on purpose.
哈?任何合理的情况下源码都会在。如果作者故意把Lua源码藏在字节码里,那就是在混淆视听、故意阻止模组制作。
>multiple mods or injecting into another mod
>多个模组或者注入到另一个模组里
if modding another mod you only need your code to execute first.
如果你要改另一个模组,只需要让你的代码先执行就行。
>says nothing
>这啥也说明不了
I'll give you a hint: ffi.C.VirtualProtect() and then you can do whatever you want.
我给你个提示:ffi.C.VirtualProtect() 然后你想干嘛都行。
↳ #148 No.109457479
Anonymous · 2026-08-04 12:20
>>109457375
> in any reasonable scenario
> 任何合理的情况下
almost no one writes whole game in lua
几乎没人用Lua写整个游戏
> if modding another mod you only need your code to execute first
> 如果你要改另一个模组,只需要让你的代码先执行就行
my mod has a function deep in it's code, inject and call some_function with 0:
我的模组代码深处有个函数,注入并调用some_function且参数为0:
local function f()
本地函数 f()
...
return game.some_function(1)
返回游戏.some_function(1)
end
> I'll give you a hint
> 我给你个提示
again, it says nothing
再说一次,这啥也说明不了
any programming language can be used for working with memory and usually it's only 1% of the work
任何编程语言都能用来操作内存,通常那只是1%的工作量
the rest 99% you fight binaries
剩下的99%是在跟二进制较劲
↳ #149 No.109457505
Anonymous · 2026-08-04 12:24
>>109457479
>almost no one writes whole game in lua
>几乎没人用Lua写整个游戏
heard of love2d?
听说过love2d吗?
>my mod has a function deep in it's code
>我的模组代码深处有个函数
heard of monkey patching?
听说过猴子补丁吗?
>any programming language can be used for working with memory
>任何编程语言都能用来操作内存
no, not any. but luajit can, and that was the entire point: you can do anything you want with it.
不,不是任何语言。但luajit可以,这才是关键点:用它你啥都能干。
↳ #150 No.109457563
Anonymous · 2026-08-04 12:34
>>109456422
lol retard
哈哈,傻逼
↳ #151 No.109457622
Anonymous · 2026-08-04 12:43
>>109457505
> heard of love2d?
> 听说过love2d吗?
never heard of games made with it
从没听说过用这做出来的游戏
> heard of monkey patching?
> 听说过猴子补丁吗?
that will only work for love2d games, not for something still alive
那玩意只对love2d游戏有效,对还在活跃的东西没用
> no, not any
> 不,不是任何语言
name three that can't work with memory or call external libraries
举三个不能操作内存或调用外部库的语言
> the entire point
> 这才是关键点
again, it's just a glue when working with binaries, a very small problem
再说一次,面对二进制时那只是胶水,一个非常小的问题
>>109457563
I accept your concession
我接受你的让步
↳ #152 No.109457670
Anonymous · 2026-08-04 12:50
>never heard of games made with it
>从没听说过用这做出来的游戏
Balatro
↳ #153 No.109457719
Anonymous · 2026-08-04 12:55
>>109457622
>never heard of Balatro
>从没听说过Balatro
↳ #154 No.109457774
Anonymous · 2026-08-04 13:03
>>109457670
> Balatro
> 巴拉特罗
>>109457719
> Balatro
> 巴拉特罗
two more
再来两个
↳ #155 No.109457802
Anonymous · 2026-08-04 13:08
>>109457774
Intravenous and Move or Die
Intravenous和Move or Die
图片: https://i.4cdn.org/g/1785848912873790.png
↳ #156 No.109457809
Anonymous · 2026-08-04 13:09
Just use javascript holy fuck
直接用JavaScript吧我操
↳ #157 No.109457810
Anonymous · 2026-08-04 13:09
apparently, Kingdom Rush steam versions?
貌似Kingdom Rush的Steam版也算?
https://steamdb.info/tech/Engine/Love2D/
This list is too short. You can help /g/ by expanding it.
这列表太短了。欢迎/g/帮它扩充。
↳ #158 No.109457823
Anonymous · 2026-08-04 13:11
>>109457809
>why would you have cake? just eat toenail clippings
>为什么要吃蛋糕?吃脚趾甲就行了
↳ #159 No.109457825
Anonymous · 2026-08-04 13:11
>>109457809
Lua did it first and better.
Lua先做到的,而且做得更好。
↳ #160 No.109457879
Anonymous · 2026-08-04 13:20
>>109457809
javascript is the chain smoker's version of lua.
JavaScript就是老烟枪版的Lua。
↳ #161 No.109457929
Anonymous · 2026-08-04 13:27
>>109457802
> Intravenous and Move or Die
> Intravenous和Move or Die
never heard of these
这俩也没听说过
↳ #162 No.109458354
Anonymous · 2026-08-04 14:24
↳ #163 No.109458446
Anonymous · 2026-08-04 14:37
>>109406230
>I want to start Lua!
>我想开始学Lua!
>oh, it starts at 1...
>哦,它从1开始数...
Get real anon, Rust and Go just werks.
醒醒吧匿名版,Rust和Go就是能干活。
↳ #164 No.109459226
Anonymous · 2026-08-04 16:30
>>109406230
what is luas usecase besides very modular and shareable video game mods and addons?
Lua 除了做高度模块化、易分享的游戏模组和插件之外还有啥用处?
↳ #165 No.109459659
Anonymous · 2026-08-04 17:24
oh wow the gmod language, that is the only reason I learned it.
哦这不就是 GMod 的语言吗,我学它就为了这个。
↳ #166 No.109461185
Anonymous · 2026-08-04 20:04
>>109455489
>winjeet try not to shill microslop level impossible
>winjeet 憋推销你的微软屎了,不可能的事
↳ #167 No.109461223
Anonymous · 2026-08-04 20:10
>>109461185
use mono or .net core i don't give a shit
用 mono 或者 .net core 都行,老子不在乎
fucking kotlin would probably work too but nobody does that
他妈的 Kotlin 大概也能跑,但没人会那么干
↳ #168 No.109462213
Anonymous · 2026-08-04 22:09
↳ #169 No.109462461
Anonymous · 2026-08-04 22:38
>>109406230
they are called arrays and indexes start at 0
那叫数组,下标从 0 开始
↳ #170 No.109462489
Anonymous · 2026-08-04 22:41
↳ #171 No.109462762
Anonymous · 2026-08-04 23:10
>>109462213
this adds nothing to it
这帖子毫无信息量
↳ #172 No.109462857
Anonymous · 2026-08-04 23:20
>>109462762
There's an awkward turn, Stallman just vanishes and it cost the taxpayer somewhere in the double digits, so it adds a lot to it
中间有个尴尬的转折,Stallman 直接消失了,还花了纳税人两位数美元,所以这帖子信息量大了去了
↳ #173 No.109465764
Anonymous · 2026-08-05 06:36
>>109462213
jihadist stallmeme?
圣战分子的烂梗?
↳ #174 No.109465813
Anonymous · 2026-08-05 06:46
>>109406230
Lua sucks but embeddable languages are comfy
Lua很烂,但可嵌入语言用起来挺舒服的。
↳ #175 No.109465822
Anonymous · 2026-08-05 06:48
↳ #176 No.109466380
Anonymous · 2026-08-05 08:55
↳ #177 No.109466635
Anonymous · 2026-08-05 09:53
>>109458446
At least Lua is making usable software
至少Lua在做能实际用的东西。
↳ #178 No.109467977
Anonymous · 2026-08-05 13:32
>>109465822
the article frames deleting tags like "luajit-2.1.0-beta3" as some kind of nuclear disaster but fails to explain why this is a bad thing, "2.1" still exists and is the sane, supported version of luajit.
这篇文章把删除像“luajit-2.1.0-beta3”这样的标签说成啥核灾难,但没解释这为啥是坏事,“2.1”还在,而且是luajit合理、受支持的版本。
↳ #179 No.109468252
Anonymous · 2026-08-05 14:07
>>109467977
Anon... I barely skimmed that article and even I picked up that it's an article arguing Lua users should stop using old legacy versions. It's even in the title. Your attention span is completely fucked.
匿名…我随便扫了一眼那篇文章都看出它是在说Lua用户该停止用老旧的旧版本。标题里都写了。你的注意力完全废了。
↳ #180 No.109468295
Anonymous · 2026-08-05 14:13
>>109468252
lol
I disagree, and I will keep using luajit 2.1 until the end of time.
我不同意,我会永远用luajit 2.1直到天荒地老。
↳ #181 No.109468380
Anonymous · 2026-08-05 14:23
>>109465822
Good article.
好文章。
↳ #182 No.109468407
Anonymous · 2026-08-05 14:26
↳ #183 No.109469536
Anonymous · 2026-08-05 16:33
>>109458354
wasted an hour watching this video.
浪费一个小时看这视频。
this talk is really basic and doesn't touch on lua language design aside from minimalism and 1-indexing, had passing mention of falsy values but not why 0 and "" being truthy is good.
这讲座真的很基础,除了极简主义和1索引之外根本没触及Lua语言设计,对falsy值只是顺带提了一句,没讲为什么0和“”为truthy是好事。
no highlights of the language like multiple return values, metatables, coroutines.
没有提到这语言的高光,比如多返回值、metatable、协程。
clearly the interviewer was not prepared nor interested in specifics of lua.
显然采访者既没准备,也没兴趣聊Lua的具体细节。
↳ #184 No.109469552
Anonymous · 2026-08-05 16:35
>>109469536
I had the same experience watching the first 20-30 minutes of that video earlier. I gave up because I was getting second-hand embarrassment from some of the questions.
我之前看这视频前20-30分钟也是这感觉。我放弃了,因为有些问题让我尴尬得脚趾抠地。
↳ #185 No.109470072
Anonymous · 2026-08-05 17:27
>>109469536
It's always the case when the interviewer is a non-programmer-but-"tech"-oriented idiot but what's really cringe is that he is asking all those questions about JIT compilers as if this brazilian nigger had anything to with it, which he recognized. What an irredeemable faggot.
采访者是非程序员但“科技”向的蠢货时总是这样,但最尬的是他问那些关于JIT编译器的问题,好像这巴西佬跟这有啥关系似的——他自己也承认了。真是个无可救药的死基佬。
↳ #186 No.109472817
Anonymous · 2026-08-05 22:27
>>109411028
>>109458354
Nice.
>Scheme is a language that I like very much because of this, exactly this economy of ideas. There are very few concepts, and it can do some amazing things with very few concepts.
>Scheme是我非常喜欢的语言,就是因为这个——正是这种思想的经济性。概念极少,但用极少的概念能做惊人的事。
https://www.developing.dev/p/creator-of-lua-scripting-programming
↳ #187 No.109474200
Anonymous · 2026-08-06 01:27
>>109465822
Lua is apparently pretty perfect for TI-Nspire calculators. I picked one up off ebay, and there's
Lua对TI-Nspire计算器来说似乎特别完美。我在ebay上买了一个,还有
ndless
that's the jailbreak thing.
那是越狱用的东西。
um.
oh yeah, n- uh. something is a free app for xfer to the cx series.
哦对,嗯-不是。有个免费app可以传到cx系列上。
n-link.
um.
and you build the like uh. "luna" which is an ndless project, I think. anyway, once you have it compiled, you just go
然后你编译一下那个叫 "luna" 的东西,我记得是个 ndless 项目。反正编译好了之后,直接敲
luna myscript.lua myscript.tns
luna myscript.lua myscript.tns(命令:用 luna 把 lua 脚本编译成 tns)
you xfer the tns script to your ti calculator and just run it (after you've activated the jailbreak, which stays activated until it goes into deep sleep, which it won't if you use it a lot - regardless, you just select the correct file and boom it's done again)
把那个 tns 脚本传到你的 TI 计算器上直接跑就行(前提是你已经激活了越狱,越狱状态会一直保持到机器深度睡眠,你要是经常用就不会触发;不管怎样,选对文件再点一下就又搞定了)
↳ #188 No.109474208
Anonymous · 2026-08-06 01:28
>>109474200
bottom line, I may never learn lua, but I'm glad it's there, and I can vibecode whatever I need on the calculator.
说到底,我可能永远学不会 Lua,但我很庆幸它有这功能,计算器上我想写啥都能靠 vibe 硬凑出来。
↳ #189 No.109474294
Anonymous · 2026-08-06 01:43
>>109474200
*rapes you*
*强吻你*
↳ #190 No.109474328
Anonymous · 2026-08-06 01:49
↳ #191 No.109474378
Anonymous · 2026-08-06 01:55
I remember once compiling luajit for the Nintendo DSi. The JIT part didn't work, but it was fine if I disabled the JIT. Played around with it for 5 minutes and then got bored
我记得有一回给 Nintendo DSi 编译 luajit。JIT 部分跑不起来,但关掉 JIT 就没事了。玩了五分钟就腻了。
↳ #192 No.109477571
Anonymous · 2026-08-06 11:16
>>109474378
>Nintendo DSi.
任天堂DSi。
based
↳ #193 No.109477739
Anonymous · 2026-08-06 11:50
>>109455452
Vintage Story has unpaid shills
Vintage Story 有一帮免费水军
↳ #194 No.109478288
Anonymous · 2026-08-06 13:32
>>109407194
can you stop shitting up the threads with these
你能不能别老拿这些玩意污染帖子了
↳ #195 No.109479732
Anonymous · 2026-08-06 16:33
>Is Lua-tan local?
>Lua-tan 是本地人吗?
>No, she's Brazilian.
>不,她是巴西的。
↳ #196 No.109480199
Anonymous · 2026-08-06 17:23
>>109406230
I am starting to learn C but I don't get how would I use this along with C.
我开始学 C 了,但搞不懂这东西怎么跟 C 配合用。
Do I need to download something?
我需要下载点啥吗?
Do I have to make my own API with Lua or does it come with ready functionality? How about random headers that you download off somewhere?
我得自己用 Lua 写 API 还是它自带现成的功能?那种网上随便下的随机头文件呢?
Do I use this language instead of C, do I embed it in C code in some way?
我是拿这语言替代 C,还是得用某种方式把它嵌进 C 代码里?
Does it actually make my life easier than just using C?
它真的能比单用 C 让我省事吗?
I just don't get it.
我就是不懂 ♯ 哈哈哈哈不,我副显示器开DSC还是有问题的
↳ #197 No.109480415
Anonymous · 2026-08-06 17:44
>>109480199
You need to download the shared library. If you're no Linux this is trivial, just use your package manager. Then you include the lua headers and link with the library.
你需要下载共享库。你要是在 Linux 上这就很简单,直接用包管理器就行。然后把 lua 头文件包含进来,再跟库链接。
↳ #198 No.109480483
Anonymous · 2026-08-06 17:50
>>109480199
Programming in Lua (pirate a new version) gives you an easy quick-start idea. https://www.lua.org/pil/24.1.html
You can use both, as much or as little as you need. If you're not sure why you need Lua in your project, then just stick with C. If you want to test, modify, or prototype something and don't want to keep recompiling your C project, then consider Lua.
两者可以混着用,想用多少用多少。你要是拿不准项目里为啥要 Lua,那就老老实实用 C。要是你想测试、改改或者快速搭个原型,又不想天天重新编译 C 项目,那就考虑用 Lua。
The C API is basically just running the VM instructions directly through C functions, so it should feel very familiar if you've already explored VM/assembly code before.
C API 说白了就是直接通过 C 函数调用虚拟机指令,你要是之前研究过 VM 或者汇编代码,应该会感觉很熟悉。
↳ #199 No.109480992
Anonymous · 2026-08-06 18:51
>>109480483
Fun fact: io.stdin and io.stdout are literally just implemented as a full userdata FILE**. It's pretty trivial to chain them into C functions accepting FILE*.
冷知识:io.stdin 和 io.stdout 其实就是用完整的 userdata FILE 实现的。把它们接到接受 FILE* 的 C 函数上简直不要太简单。
↳ #200 No.109480999
Anonymous · 2026-08-06 18:52
>>109480483
So Lua is executing the C API calls in the background? How's the performance?
所以 Lua 是在后台执行 C API 调用?性能怎么样?
↳ #201 No.109481761
Anonymous · 2026-08-06 20:24
↳ #202 No.109481822
Anonymous · 2026-08-06 20:30
>>109480483
hot reloading is trivial, that isn’t really much of an argument for scripting languages anymore
热重载现在已经很轻松了,这不太能算脚本语言的优势了
↳ #203 No.109482475
Anonymous · 2026-08-06 21:42
>>109480999
Lua is generally considered very fast
一般来说 Lua 算很快的了
↳ #204 No.109482485
Anonymous · 2026-08-06 21:43
↳ #205 No.109482966
Anonymous · 2026-08-06 22:33
>>109482475
*among interpreted non-JITed scripting languages, in comparison to Python
*在非 JIT 的解释型脚本语言里,跟 Python 比的话
compared to a natively compiled language or JITed language it's very slow
但跟原生编译语言或者 JIT 语言比,那就慢得多了
↳ #206 No.109483057
Anonymous · 2026-08-06 22:45
ChatGPT says Lua is faster than Haskell.
ChatGPT 说 Lua 比 Haskell 快。
↳ #207 No.109483120
Anonymous · 2026-08-06 22:55
The frog in my ass says pigs can fly.
我屁股里的青蛙还说猪会飞呢。
(如果你觉得这篇文章有启发,可以点击这里付费)
本站总访问量 次访客数 人