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
|
||||
It returns the generated lua as string.
|
||||
|
||||
## todo
|
||||
- perhaps write generated lua files to disk
|
||||
- perhaps generate venus from lua
|
||||
### generating lua files
|
||||
`vp.convert_venus_file(venus_file_in,lua_file_out)` generates a lua file
|
||||
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()
|
||||
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
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
local vp = dofile("init.lua")
|
||||
local o = "testout/test.lua"
|
||||
|
||||
local s = vp.tl_venus_file("test.venus")
|
||||
local f = io.open(o,"w")
|
||||
f:write(s)
|
||||
f:close()
|
||||
vp.convert_venus_file("test.venus",o)
|
||||
|
||||
dofile(o)
|
||||
|
|
Loading…
Reference in New Issue