···11# svg-lua
22+23svg lua library
3444-# usage
55+## usage
66+57```lua
68mon_dessin = svg:create()
79mon_dessin:add(mon_dessin:Rect())
···911```
10121113result for `print(mon_dessin:draw())` :
1414+1215```html
1316<svg width="100" height="100" fill="transparent" stroke="#000000" version="1.1" xmlns="http://www.w3.org/2000/svg">
1417 <rect y="10" x="10" stroke-width="1" height="10" width="10" rx="0" ry="0" />
···1619```
17201821### testing
2222+1923can be tested [here](https://www.lua.org/cgi-bin/demo) *(use the minified version, the text field is limited in size)*
20242121-*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`*
2525+to test using the binaries included in the project:
2626+2727+- open a command prompt un the subdirectory `lua5.3.4-win64` *(Shift+Right Click on Windows)*
2828+- type `lua53.exe ..\test.lua`
2929+3030+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:
3131+3232+- `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`.
3333+- `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.
3434+3535+If you are using a custom test file, replace `test.lua` by your file name.
22362337### minified version
3838+2439`svg.min.lua` generated with [Lua Minifier from Mothereff.in](https://mothereff.in/lua-minifier)
25402626-# Documentation
4141+## Documentation
4242+2743### Main methods
4444+2845**svg:create(width, height, stroke, fill)** *create the svg object*
29463047 - width: number => width of the drawing, default to 100
···3956**svg:draw()** *return the svg formated string*
40574158### Elements for svg:add(element)
5959+4260**svg:Text(text, x, y, style, transform)** *add text*
43614462 - text: string => the text to write