[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: reflection in lua
- From: Flyer31 Test <flyer31@...>
- Date: Thu, 10 Feb 2022 09:37:20 +0100
PS: Sorry, the name was not given correctly ... you have to look for
"Visual Studio Code" (in contrast to the "more standard" "Visual
Studio 2019" which is the "full compiler suite" of MS, this of course
is NOT free of cost, but also much more restricted concerning Lua
editing ... it also has some Lua file support, but only VERY
restricted, not really usable if you are used to the luxury of the Lua
support in Visual Studio Code (together with Sumneko extension
installed ("Lua Language Server coded by Lua" from sumneko)).
On Thu, Feb 10, 2022 at 9:27 AM Flyer31 Test <email@example.com> wrote:
> If you want to see such "undefined function" invoke directly during
> coding, I would recommend to use as "Lua code editor" the MS Visual
> Studio (do NOT mixup with standard Visual Code compiler!), together
> with Sumneko Lua interface installed. This is really VERY nice... it
> will show you any "undefined function" invocation immediately with red
> curly line... and you can also VERY easily create help files in lua
> for your own userdefined functions (just ASCII, but with nice markdown
> formatting support for comments...). You will get then online
> auto-edit-support for such "user-defined" functions.
> Really very nice and free of cost, sometimes really impressive /
> surprising that such a large company as MS can get such innovative
> new stuff so nicely running, based on simple solutions :).
> On Wed, Feb 9, 2022 at 7:31 PM Roman Gershman <firstname.lastname@example.org> wrote:
> > Thanks!
> > On Wed, Feb 9, 2022 at 8:27 PM Petri Häkkinen <email@example.com> wrote:
> >> > On 8 Feb 2022, at 17.50, Roman Gershman <firstname.lastname@example.org> wrote:
> >> >
> >> > Hi, suppose I compile the code below via luaL_loadbuffer and subsequent lua_pcall calls.
> >> >
> >> > function foo(n)
> >> > return someundefined_func(1, n)
> >> > end
> >> >
> >> >
> >> > Is it possible to know somehow that foo calls someundefined_func which accepts 2 arguments?
> >> > In other words, is there an API that allows querying referenced symbols and in the case of functions - their signatures?
> >> >
> >> There is no such API in Lua. This may not be what you're looking for, but Luau, Roblox's custom Lua implementation, has a very good static code analysis machinery which would be a good basis to build somethig like this. You can easily build the AST from Lua source and iterate it. It's based on Lua 5.1 though.
> >> Petri
> > --
> > Best regards,
> > Roman