GetKeysFromDict

Run Settings
LanguageLua
Language Version
Run Command
local GetKeys = function(Dict) assert(type(Dict) == "table", "Expected 1st argument to be a dict") assert(Dict[1] == nil, "Expected 1st argument to be a dict") local Keys = {} for Key, _ in pairs(Dict) do table.insert(Keys, Key) end return Keys end local Dict = {A = "B", C = "D"} local Keys = GetKeys(Dict) --> {A, C} print(Keys) local s, e = pcall(function() local Array = {"A", "B"} return GetKeys(Array) end) print(e) --> Error local s2, e2 = pcall(function() local String = "A, B" return GetKeys(String) end) print(e2) --> Error
Editor Settings
Theme
Key bindings
Full width
Lines