feat: add example demonstrating module import with Cthulu and Lovecraft classes
Add two new Wren source files under example/import-module/ showing how to import and use a module. The cthulu.wren file defines a Cthulu class with a message method returning a Lovecraftian phrase, while lovecraft.wren imports the Cthulu class, instantiates it, and prints the message via IO.print.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import "cthulu" for Cthulu
|
||||
|
||||
class Lovecraft {
|
||||
say {
|
||||
return (new Cthulu).message
|
||||
}
|
||||
}
|
||||
|
||||
IO.print((new Lovecraft).say)
|
||||
Reference in New Issue
Block a user