Re: Function statement name syntax in Lua
"'Martin Eden' via lua-l" <[email protected]>
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <[email protected]> |
On 2026-01-31 13:06, bil til wrote:
>> function t:a() return self end -- What are those "s" "e" "l" "f" ?
> ... maybe this needs an "additional learning step" for new Lua programmers.
>
> But I think especially for meta-tabels (typically e. g. some C
> programmed userdata) this is super-nice and very intuitive.
>
> (e. g. file f..., f:write(...) instead of file.write( f, ...) ).
Hello Bil,
I'm talking that ":" sugar in function definition considered harmful.
In function _definition_. Not in function call.
Let me create more ugly example:
self = {}
function self:self() return self end
print(self:self())
What "self" is returned here and _why_?
Versus
self = { self = function(self) return self end }
print(self:self())
Good language requires little knowledge to understand.
-- Martin
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/87828be0-714d-47c6-9d12-d2fb1b8b6d0d%40disroot.org.