diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8305575 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +lua5.3.4-win64/result.html \ No newline at end of file diff --git a/README.md b/README.md index becb6f6..90a3cd3 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # svg-lua + svg lua library -# usage +## usage + ```lua mon_dessin = svg:create() mon_dessin:add(mon_dessin:Rect()) @@ -9,6 +11,7 @@ mon_dessin:draw() ``` result for `print(mon_dessin:draw())` : + ```html @@ -16,15 +19,29 @@ result for `print(mon_dessin:draw())` : ``` ### testing + can be tested [here](https://www.lua.org/cgi-bin/demo) *(use the minified version, the text field is limited in size)* -*you can use the content of the file `test.lua` for testing, it includes the minified version and all elements with default values, the result can be found in `index.html`* +to test using the binaries included in the project: + +- open a command prompt un the subdirectory `lua5.3.4-win64` *(Shift+Right Click on Windows)* +- type `lua53.exe ..\test.lua` + +If you want to save the output in a file to see the result you can add ` > result.html` or ` >> result.html` following the previous command to save the result in an html file: + +- `lua53.exe ..\test.lua > result.html`: this will create a file `result.html` in the directory with the resul, replacing the file if already exists this can be done using `test.bat`. +- `lua53.exe ..\test.lua >> result.html`: this will create a file `result.html` in the directory with the resul, appending result to the existing file if already exists. + +If you are using a custom test file, replace `test.lua` by your file name. ### minified version + `svg.min.lua` generated with [Lua Minifier from Mothereff.in](https://mothereff.in/lua-minifier) -# Documentation +## Documentation + ### Main methods + **svg:create(width, height, stroke, fill)** *create the svg object* - width: number => width of the drawing, default to 100 @@ -39,6 +56,7 @@ can be tested [here](https://www.lua.org/cgi-bin/demo) *(use the minified versio **svg:draw()** *return the svg formated string* ### Elements for svg:add(element) + **svg:Text(text, x, y, style, transform)** *add text* - text: string => the text to write diff --git a/index.html b/index.html deleted file mode 100644 index 8807a8e..0000000 --- a/index.html +++ /dev/null @@ -1 +0,0 @@ -this is a test diff --git a/lua5.3.4-win64/test.bat b/lua5.3.4-win64/test.bat new file mode 100644 index 0000000..8ebd901 --- /dev/null +++ b/lua5.3.4-win64/test.bat @@ -0,0 +1 @@ +lua53.exe ..\test.lua > result.html \ No newline at end of file