lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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 <romange@gmail.com> wrote:
>
> Thanks!
>
> On Wed, Feb 9, 2022 at 8:27 PM Petri Häkkinen <petrih3@gmail.com> wrote:
>>
>>
>> > On 8 Feb 2022, at 17.50, Roman Gershman <romange@gmail.com> 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