add function that generates lua files
This commit is contained in:
parent
4f5c32ecfe
commit
c07ab92d9a
|
@ -184,6 +184,7 @@ It returns the generated lua as string.
|
||||||
`vp.tl_venus_string(str)` returns the lua generated from the given string
|
`vp.tl_venus_string(str)` returns the lua generated from the given string
|
||||||
It returns the generated lua as string.
|
It returns the generated lua as string.
|
||||||
|
|
||||||
## todo
|
### generating lua files
|
||||||
- perhaps write generated lua files to disk
|
`vp.convert_venus_file(venus_file_in,lua_file_out)` generates a lua file
|
||||||
- perhaps generate venus from lua
|
It's arguments can be relative or absolute paths.
|
||||||
|
The venus_file_in will be converted to lua and written to lua_file_out.
|
||||||
|
|
7
init.lua
7
init.lua
|
@ -461,4 +461,11 @@ function parser.dovenus(file)
|
||||||
return ff()
|
return ff()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function parser.convert_venus_file(venus_file_in,lua_file_out)
|
||||||
|
local s = parser.tl_venus_file(venus_file_in)
|
||||||
|
local f = io.open(lua_file_out,"w")
|
||||||
|
f:write(s)
|
||||||
|
f:close()
|
||||||
|
end
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
local vp = dofile("init.lua")
|
local vp = dofile("init.lua")
|
||||||
local o = "testout/test.lua"
|
local o = "testout/test.lua"
|
||||||
|
|
||||||
local s = vp.tl_venus_file("test.venus")
|
vp.convert_venus_file("test.venus",o)
|
||||||
local f = io.open(o,"w")
|
|
||||||
f:write(s)
|
|
||||||
f:close()
|
|
||||||
|
|
||||||
dofile(o)
|
dofile(o)
|
||||||
|
|
Loading…
Reference in New Issue