Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cattokomo/tluvit
A Teal (.tl) runner for the Luvit Runtime
https://github.com/cattokomo/tluvit
Last synced: 4 months ago
JSON representation
A Teal (.tl) runner for the Luvit Runtime
- Host: GitHub
- URL: https://github.com/cattokomo/tluvit
- Owner: cattokomo
- License: mit
- Created: 2022-09-23T03:13:13.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-28T10:02:45.000Z (about 2 years ago)
- Last Synced: 2024-05-19T01:54:36.732Z (6 months ago)
- Language: Lua
- Size: 59.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
> This loader is mentioned in [awesome-teal](https://github.com/teal-language/awesome-teal) repository, check it out!
# tluvit
A Teal (.tl) runner for the Luvit Runtime## Usage
```lua
local tluvit = require("tluvit")-- Path to the "tl.lua",
-- defaults to "" (none)
tluvit.tlpath = ""-- Load the .tl into Luvit runtime
--
-- Argument #1 pass string of the filename (path),
-- defaults to "main.tl"
--
-- Argument #2 pass boolean if the loader
-- want to not do type checking (notc),
-- defaults to "false"
tluvit.loadtl("main.tl", false)
```
---
`tluvit` can also load a .tl module using `tluvit.loadtl`:
```lua
-- In main.lua
require("pretty-print")
local tluvit = require("tluvit")local tlmodule = tluvit.loadtl("mylibs.tl")
-- You can also pass boolean on argument "notc"
-- to load the module without errorsp(tlmodule)
```
```
-- In mylibs.tl
local record Mylibs
printHi: function()
foo: string
endlocal mylibs: Mylibs = {}
function mylibs.printHi()
print("Hi")
endmylibs.foo = "Foo!"
return mylibs
```
Output:
```
{ foo = 'Foo!', printHi = function: 0xe7cda370 }
```