15 lines
371 B
Lua
15 lines
371 B
Lua
-- /bin/ls - Lists files in a directory.
|
|
local dir = current_dir -- Get directory object from C++.
|
|
local output = ""
|
|
|
|
-- Iterate over the 'children' map exposed via C++.
|
|
for name, node in pairs(dir.children) do
|
|
output = output .. name
|
|
if node.type == 1 then -- 1 is DIR_NODE enum from C++.
|
|
output = output .. "/"
|
|
end
|
|
output = output .. " "
|
|
end
|
|
|
|
return output
|