Skip to content

Is it possible to get parsed emmylua "object model" as lua table? #717

Answered by sumneko
lua-rocks asked this question in Q&A
Discussion options

You must be logged in to vote

You may use the following plugin, learn plugin here: https://github.com/sumneko/lua-language-server/wiki/Plugin

local files = require 'files'
local util  = require 'utility'
local furi  = require 'file-uri'
local fs    = require 'bee.filesystem'

local function isEnableKey(k)
    if type(k) ~= 'string' then
        return true
    end
    if k == 'parent'
    or k == 'typeGeneric'
    or k == 'fields'
    or k:find '_'
    or k:find 'Cache'
    or k:find 'bind' then
        return false
    end
    return true
end

local function copyData(t)
    local nt = {}
    for k, v in pairs(t) do
        if isEnableKey(k) then
            if type(v) == 'table' then
                nt[k] = copyData(v)…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lua-rocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants