Importing libraries

This commit is contained in:
2025-10-29 11:45:58 +00:00
parent db963463b0
commit 7e071a1b01
5 changed files with 101 additions and 5 deletions

View File

@@ -83,8 +83,41 @@ main = func {
}
```
Or this:
```
main func {
dingus(dingus)
}
dingus func {
arg0(arg0)
}
```
<sub>functions are indeed objects >:)</sub>
Funk supports importing other libraries written in Funk (FFI libraries will come soon). Use the import function to import those libraries.
Ensure that the library you are importing is in the directory pointed to by the `FUNK_HOME` environment variable.
```
// myCoolLibrary.funk
importedFunction func {
println("The imported function has been called")
}
importedValue = "Hi there from the library!"
// main.funk
import("myCoolLibrary")
main func {
myCoolLibrary::importedFunction()
println(myCoolLibrary::importedValue)
}
```
## License
Funk is licensed to you under the GNU GPL v3.0. Contributions are welcome!