Rickzzs Posted March 5, 2023 Share Posted March 5, 2023 (edited) local DirectCFunctions = {} local CMetatables = {} local MetaReference = {} local token = "[C]" local function GetDefinition(fn) local from = debug.getinfo(fn, "S") return from.what, from.source, from.linedefined end local function FilterMetatable(meta) local ret = {} for k, v in pairs(meta) do if type(v) == "function" then local from, source, line = GetDefinition(v) if from == "C" then ret[k] = token else ret[k] = (source or "?") .. ":" .. (line or "?") end else ret[k] = v end end return ret end for k, v in pairs(_G) do if type(v) == "function" then local from = GetDefinition(v) if from == "C" then DirectCFunctions[k] = v end elseif type(v) == "userdata" then local meta = getmetatable(v) if meta then local t = meta.__index if type(t) == "table" then if MetaReference[t] then CMetatables[k] = MetaReference[t] else local name = tostring(t) if name then print(k, name) end CMetatables[k] = FilterMetatable(t) MetaReference[t] = k end else CMetatables[k] = t end end elseif type(v) == "table" and k ~= "_G" then if MetaReference[v] then CMetatables[k] = MetaReference[v] else local _, firstfn = next(v) if type(firstfn) == "function" then local from = GetDefinition(firstfn) if from == "C" then CMetatables[k] = FilterMetatable(v) MetaReference[v] = k end end end end end local function PrettyPrint(t) local strs = {} local function i(x) table.insert(strs, tostring(x)) return i end local function escape(s) s = tostring(s) return s:gsub("\\", "\\\\"):gsub("'", "\\\"") end for k, v in pairs(t) do i(k)("=") if type(v) ~= "table" then i(v) else i("{\n") for n, f in pairs(v) do i(n)("=") if f == token then i("function(...)print('C')end") else i("function(...)print('" .. escape(f) .. "')end") end i(",\n") end i("}") end i("\n") end return table.concat(strs) end function _G.PrintFunctions() print(PrettyPrint({direct = DirectCFunctions})) print(PrettyPrint(CMetatables)) end function _G.DumpFunctions() local f = io.open("engine.lua", "w") if not f then print("error: failed to open engine.lua") return end f:write(PrettyPrint({direct = DirectCFunctions})) f:write(PrettyPrint(CMetatables)) f:close() end So it helps to list all the C functions for VS Code lua extension. engine.lua Edited March 5, 2023 by Rickzzs 2 Link to comment https://forums.kleientertainment.com/forums/topic/126774-documentation-list-of-all-engine-functions/page/2/#findComment-1623545 Share on other sites More sharing options...
Lyserus Posted April 28, 2023 Share Posted April 28, 2023 Can you help me with an example on how to use TheInventory:CheckClientOwnership and inst.AnimState:AssignItemSkins in a non-player prefab lua to change its skin to DLC ones? I am trying to create a follower and want it to look like wanda, I've been stuck for a long long time now Link to comment https://forums.kleientertainment.com/forums/topic/126774-documentation-list-of-all-engine-functions/page/2/#findComment-1632492 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now