3

Lua IDE のコード補完コントロールに取り組んでいます

https://github.com/AndersMalmgren/FreePIE

リフレクションを使用して、スクリプトからアクセス可能な C# オブジェクト情報を取得していますが、数学ライブラリなどのように、リストに Lua 固有のものも含めたいと考えています。

これらを入手する方法はありますか?if、then、end などのすべてのキーワードも取得したい

4

1 に答える 1

6

これらを入手する方法はありますか?

マニュアルにはすべてが含まれていますが、起動時にグローバル名前空間を繰り返し処理してすべてを取得することもできます (これは、名前空間に何かを追加する前に、早い段階で行う必要があります!)。何かがテーブルである場合、それはstringorのような名前空間でもあり、それtableを反復処理してメソッドを取得できます。

local exclude = { _G = true, _VERSION = true, arg = true }
for name, value in pairs(_G) do
    if not exclude[name] then
        print(name)
        if type(value) == 'table' then
            for name, value in pairs(value) do
                print('\t', name)
            end
        end
    end
end

以下を生成します。

string
                sub
                upper
                len
                gfind
                rep
                find
                match
                char
                dump
                gmatch
                reverse
                byte
                format
                gsub
                lower
xpcall
package
                preload
                loadlib
                loaded
                loaders
                cpath
                config
                path
                seeall
tostring
print
os
                exit
                setlocale
                date
                getenv
                difftime
                remove
                time
                clock
                tmpname
                rename
                execute
unpack
require
getfenv
setmetatable
next
assert
tonumber
io
                lines
                write
                close
                flush
                open
                output
                type
                read
                stderr
                stdin
                input
                stdout
                popen
                tmpfile
rawequal
collectgarbage
getmetatable
module
rawset
math
                log
                max
                acos
                huge
                ldexp
                pi
                cos
                tanh
                pow
                deg
                tan
                cosh
                sinh
                random
                randomseed
                frexp
                ceil
                floor
                rad
                abs
                sqrt
                modf
                asin
                min
                mod
                fmod
                log10
                atan2
                exp
                sin
                atan
debug
                getupvalue
                debug
                sethook
                getmetatable
                gethook
                setmetatable
                setlocal
                traceback
                setfenv
                getinfo
                setupvalue
                getlocal
                getregistry
                getfenv
pcall
table
                setn
                insert
                getn
                foreachi
                maxn
                foreach
                concat
                sort
                remove
newproxy
type
coroutine
                resume
                yield
                status
                wrap
                create
                running
select
gcinfo
pairs
rawget
loadstring
ipairs
dofile
setfenv
load
error
loadfile
于 2012-08-06T19:10:39.023 に答える