blob: 8a271689d90dd624ee8c7aef5c93164af7ff9db3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
use "core"
action [path of Nomsu file %filename]
lua> ".."
for f in files.walk(\%filename) do return f end
barf "Could not find file: \%filename"
action [sh> %cmd]
lua> ".."
local result = io.popen(\%cmd)
local contents = result:read("*a")
result:close()
return contents
action [read file %filename]
=lua "files.read(\%filename)"
compile [for file %f in %path %body] to
Lua ".."
for \(%f as lua expr) in files.walk(\(%path as lua expr)) do
\(%body as lua statements)
\(compile as: === next %f ===)
end
\(compile as: === stop %f ===)
action [write to file %filename %text, to file %filename write %text]
lua> ".."
local file = io.open(\%filename, 'w')
file:write(\%text)
file:close()
|