Importing libraries
This commit is contained in:
33
README.md
33
README.md
@@ -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!
|
||||
|
||||
Reference in New Issue
Block a user