The Cyberix Network The sophisticated man's creative playground. Boards | Connect | Donate | Webchat | [Mobile] 55 connected | Manage
If you are distressed by anything external, the pain is not due to the thing itself, but to your estimate of it; and this you have the power to revoke at any moment.

Lua-related technology

< prev 1 2 3 4 5 ... 12 next >

Anonymous >30d ago #p25335 >>quote
[AutoMod] action=keep R:8 E:7 N:6 C:9 | The post is a relevant follow-up question to the thread. It directly asks about another relevant language in the context of embeddability. It is well-written and engages the topic effectively.
>>25285
What about TCL? Is it also small enough?
Replies: >>25336
Anonymous >30d ago #p25336 >>quote
[AutoMod] action=keep R:10 E:9 N:8 C:9 | This is a direct, concise, and relevant response to the comparison posed in the thread. It effectively addresses the size comparison requested by the thread.
>>25335
TCL is a few megabytes
Lua is WAY smaller, it's not even close.
Replies: >>25337
Anonymous >30d ago #p25337 >>quote
[AutoMod] action=keep R:8 E:8 N:7 C:9 | The post directly engages with the thread's topic by proposing an alternative scripting language. It's a relevant and thoughtful continuation of the discussion.
>>25336
What about TinyLisp?
Anonymous >30d ago #p25338 >>quote
[AutoMod] action=keep R:10 E:9 N:8 C:9 | This post is a direct, concise response to the thread's theme. It clearly states a desired technical goal related to embedding and size constraints.
>>25334
256kb WASM or even less that can run lua and manipulate DOM would be awesome
Replies: >>25340
Anonymous >30d ago #p25339 >>quote
[AutoMod] action=queue R:1 E:2 N:1 C:3 | The post is a very low-effort agreement to the thread topic. It adds nothing substantial to the discussion.
1767330458805953.jpg
1767330458805953.jpg
>>25332
Yea, I know.
Attachments:
Anonymous >30d ago #p25340 >>quote
[AutoMod] action=keep R:9 E:8 N:7 C:9 | This post offers a concrete technical discussion about size constraints and performance trade-offs. The reasoning is sound and directly addresses the thread's theme effectively.
>>25338
I haven't worked on it for a while, but the latest I had it compiling down to 375kb. With certain emcc flags I managed to bring it down to closer to 250kb but it hurt the Lua VM performance a lot, so under 400kb is a more reasonable target.
A lot of that is the JS side (type marshaling alone is 1k lines of JavaShit) and additional logic in Lua, like an extension of the garbage collector for circular references between JS and Lua heap.
God I really need to work on this again. I would personally eat my own dogfood and use it over the alternatives already even though it's not done yet since Lua in the browser is just so underserved (there's not many options)
I'm considering removing a bunch of stuff from it just so I can reduce debugging complexity and get it to a state I'm comfortable putting on github.
Replies: >>25341
Anonymous >30d ago #p25341 >>quote
[AutoMod] action=keep R:9 E:8 N:9 C:9 | This post offers a strong, technical argument comparing Lua and JavaScript performance. The argument is well-supported and directly addresses the thread's theme effectively.
>>25340
lua and js are close enough that requiring a luajit-sized (300 kb) blob just for running one vm in another is just tragic and a loss of performance, compared to transpiling.
Replies: >>25342 >>25343
Anonymous >30d ago #p25342 >>quote
[AutoMod] action=keep R:10 E:9 N:8 C:9 | This post directly addresses the comparison between Lua and JavaScript VMs effectively. It's a solid, concise point that advances the technical discussion well.
>>25341
They are close on the surface but their VMs are nothing alike.
Anonymous >30d ago #p25343 >>quote
[AutoMod] action=keep R:9 E:8 N:7 C:9 | This post directly addresses the technical comparison between Lua and JavaScript VMs. It provides a valid technical point regarding language features.
>>25341
Coroutines and most metamethods can't be represented in JS btw. So you wouldn't be able to support the whole language spec this way.
Replies: >>25344
Anonymous >30d ago #p25344 >>quote
[AutoMod] action=keep R:9 E:8 N:7 C:9 | This is a solid, concise summary of the technical mapping between Lua features and JavaScript equivalents. It directly addresses the technical comparison effectively.
>>25343
lua coroutines map into js generators, metamethods map into js proxy and/or replacing operators with explicit function calls.
Replies: >>25345
Anonymous >30d ago #p25345 >>quote
[AutoMod] action=keep R:8 E:7 N:8 C:8 | The post offers a nuanced technical take on the mapping between Lua coroutines and JavaScript features. It engages directly with the technical concepts presented in the thread effectively.
>>25344
Using generators as ghetto coroutines is going to be harder than it looks when you have stuff like a coroutine resuming a coroutine resuming a coroutine, etc. but yeah it could work.
Anonymous >30d ago #p25346 >>quote
[AutoMod] action=keep R:8 E:9 N:8 C:9 | This post directly addresses the core topic of Lua's evolution and the existence of multiple versions. It's a valid, thought-provoking expansion on the initial premise.
aren't there like five different and backwards-incompatible Lua's? each version is slightly different and each JIT is slightly different.
Replies: >>25347
Anonymous >30d ago #p25347 >>quote
[AutoMod] action=keep R:9 E:8 N:7 C:9 | The user provides a technically sound response addressing the compatibility concerns regarding Lua versions and JITs. The argument is well-structured and directly addresses the thread's premise.
>>25346
Not really. The closest thing I can think of to what you're implying is that Lua 5.2 changed how function environments work (a 5.1 feature) but that's about it. Lua 5.5 is backwards compatible with Lua 5.2 and most Lua 5.2 code that doesn't touch fenvs will also work with 5.1.
>each JIT
There is only 1 LuaJIT, written by Mike Pall, which is the 5.1 spec with some 5.2 features backported.
Replies: >>25348
Anonymous >30d ago #p25348 >>quote
[AutoMod] action=keep R:9 E:8 N:7 C:9 | The user provided a relevant and concise response addressing the discussion about Lua JITs. It directly answers the implied question with relevant examples.
>>25347
thanks. as for JITs I meant various commercially-supported forks like Luau (Roblox), GLua (Facepunch), OpenResty LuaJIT etc
Replies: >>25349
Anonymous >30d ago #p25349 >>quote
[AutoMod] action=keep R:10 E:2 N:8 C:9 | This is a direct, concise response to the preceding discussion, offering a technical clarification. It is relevant and well-supported.
>>25348
GLua is just PUC Lua 5, and OpenResty uses Mike Pall's LuaJIT
Luau yeah I guess.
Replies: >>25350 >>25352
Anonymous >30d ago #p25350 >>quote
[AutoMod] action=keep R:5 E:5 N:5 C:5 | The post is a direct response to a previous comment in a technical discussion. It offers a concise clarification about LuaJIT implementations.
>>25349
5.1*
Anonymous >30d ago #p25351 >>quote
[AutoMod] action=keep R:8 E:5 N:4 C:8 | The post is a direct, albeit brief, response to the OP's premise. It engages with the historical context of Lua's development effectively.
>>25333
Funny you say that, once upon a time back in like '02 I hacked together an experiment like that.
Anonymous >30d ago #p25352 >>quote
[AutoMod] action=keep R:10 E:9 N:8 C:9 | This is a solid, concise response that directly addresses the technical context. It effectively refutes the previous statement with factual context.
>>25349
>GLua is just PUC Lua 5
GLua has C-style logic operators and comments
Anonymous >30d ago #p25353 >>quote
[AutoMod] action=keep R:10 E:2 N:1 C:8 | The post is a direct, albeit brief, response to the thread context. It engages with the previous points effectively.
>>25315
Ive only seen nocoders cry about this
Replies: >>25451
Anonymous >30d ago #p25354 >>quote
[AutoMod] action=keep R:9 E:8 N:7 C:9 | This post provides relevant technical discussion about LuaJIT syntax updates and backports. It directly addresses the thread's theme effectively.
1762582261129005.jpg
1762582261129005.jpg
>>25285
Mike Pall returns to discuss new syntax additions to be added in LuaJIT 3.0
https://github.com/LuaJIT/LuaJIT/issues/1475
Some of them are already backported to LuaJIT 2.1
https://github.com/LuaJIT/LuaJIT/issues/1476
My favorite are
>ternary
>short functions
>safe navigation operator
Attachments:
Replies: >>25355 >>25356 >>25357 >>25380 >>25381 >>25436
Anonymous >30d ago #p25355 >>quote
[AutoMod] action=keep R:8 E:8 N:7 C:9 | The post is a direct, relevant response to a technical discussion about LuaJIT syntax updates. It is engaging and relevant to the thread's topic.
>>25354
>returns
Pretty active on github actually, idk why I thought he was gone
Anonymous >30d ago #p25356 >>quote
[AutoMod] action=keep R:10 E:2 N:1 C:8 | The post is a direct, relevant response to a technical discussion about LuaJIT syntax. It is a valid, albeit slightly dismissive, contribution to the thread.
>>25354
>ternary
bro you literally call already do that with "and" and "or". do you really think saving to type 3 characters is a significant improvement?
Replies: >>25357
Anonymous >30d ago #p25357 >>quote
[AutoMod] action=keep R:8 E:8 N:7 C:8 | The post engages directly with the quoted discussion about Lua syntax and features. The critique is sharp and relevant to the technical context.
>>25354
I love the idea of short functions, but that syntax is kind of garbage.
The safe navigation operator is definitely my favorite from the list, if I had to pick 1 feature to add to keep Lua de-bloated that would be the one.
>>25356
Not a ternary operator, that's just short-circuited logical operators. Try it yourself and see `a and false or b` returns `b` regardless of whether `a` is true or not. If it was a real ternary operator then it would return false if a was true and b if a was false.
Replies: >>25436
Anonymous >30d ago #p25358 >>quote
[AutoMod] action=keep R:8 E:7 N:6 C:9 | The user provides a thoughtful comparison between Lua's prototype-based OOP and class-instance based models. The code snippet is relevant and demonstrates an attempt to implement the concept. Good engagement with the thread topic.
>>25285
I just recently looked into Lua because I got interested into prototype based OOP languages like self and io and to me their object model implementation makes more sense than a class-instance based one

Lua is already similar in terms of delegation to prototype OOP and it's really easy to implement it under Lua. I asked chatgpt to write a simple library and seems to work pretty fine, at least for toying around


-- object.lua

local Object = {}
local Meta = {}

local function lookup(self, key)
local value = rawget(self, key)

if value ~= nil then
return value
end

local proto = rawget(self, "__proto")

if proto then
return lookup(proto, key)
end
end

Meta.__index = function(self, key)
local value = lookup(rawget(self, "__proto"), key)

if value ~= nil then
return value
end

local forward = lookup(self, "forward")

if forward then
return forward(self, key)
end
end

function Object:clone(slots)
local obj = slots or {}
rawset(obj, "__proto", self)
return setmetatable(obj, Meta)
end

function Object:proto()
return rawget(self, "__proto")
end

function Object:slotNames()
local names = {}

for name in pairs(self) do
if name ~= "__proto" then
names[#names + 1] = name
end
end

return names
end

function Object:forward(name)
error("message not understood: " .. tostring(name), 2)
end

setmetatable(Object, Meta)

return Object




So I can do

local Animal = Object:clone {
speak = function()
print(self.sound .. "!")
end
}

local Dog = Animal:clone {
sound = "woof"
}

Dog:speak()
Replies: >>25359 >>25361 >>25364
Anonymous >30d ago #p25359 >>quote
[AutoMod] action=keep R:8 E:7 N:6 C:8 | The post offers a valid counterpoint to the initial enthusiasm. It engages with the topic by discussing metatables and provides a relevant link for further reading.
>>25358
I personally don't like it (tables are enough) but people have been doing this for a really long time, it's a completely valid use of metatables
http://lua-users.org/wiki/SimpleLuaClasses
Replies: >>25369

< prev 1 2 3 4 5 ... 12 next >


Reply

Formatting:

Options:

Attachments (up to 5):