[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: This works... but is it guaranteed to?
- From: Enrico Colombini <erix@...>
- Date: Mon, 3 Oct 2022 20:24:38 +0200
On 03-Oct-22 19:39, Francisco Olarte wrote:
On Mon, 3 Oct 2022 at 19:24, bil til <firstname.lastname@example.org> wrote:
if I call f.abc() where .abc does not exist,
Sorry, but a basic question from a Lua beginner, not in "Lua tricks
state" yet, sorry... . (and I do not really see how you can call this
solution approach "simple" :) ).
I assume, you do NOT have any access to f, e. g. f would be a module
loaded from some external source?
Not the OP, but it may be the opposite problem ( he wants to pass the
table to someone which calls arbitrary methods, possibly with a
somehow more complicated logic for function generation ).
(as if you would have the table f defined INSIDE this lua file, then
it should be very straight forward just to add an additional function
If it were just the file, he could just call print("abc",...) ;-> I
would assume it is a proof of concept of a more complex thing ( given
the global variable usage, among other things ).
It will be a small cog in the redesign of my old Medusa compiler
The call f.abc() happens in the book 'source'; 'abc' will be an
arbitrary string for a CSS class selector, defined by the book's author.
Thanks to all who pointed out my beginner's mistake!
It makes me feel many, many years younger ;-)
As I said, I had noy touched Lua for some time (sigh).