mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 14:18:42 +01:00
add simple example for importing a module
This commit is contained in:
5
example/import-module/cthulu.wren
Normal file
5
example/import-module/cthulu.wren
Normal file
@ -0,0 +1,5 @@
|
||||
class Cthulu {
|
||||
message {
|
||||
return "Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn"
|
||||
}
|
||||
}
|
||||
9
example/import-module/lovecraft.wren
Normal file
9
example/import-module/lovecraft.wren
Normal file
@ -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