Skip to content

Commit

Permalink
Added Wonkey samples
Browse files Browse the repository at this point in the history
  • Loading branch information
seyhajin authored Jul 26, 2022
1 parent edeef06 commit 41e1e81
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions samples/Monkey/vec2.wx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
struct Vec2<T>
field x:T
field y:T

method new( x:T, y:T )
self.x = x
self.y = y
end

operator+:Vec2( v:Vec2 )
return new Vec2( x + v.x, y + v.y )
end

operator to:string()
return "Vec2(" + x + ", " + y + ")"
end
end

alias Vec2<float> Vec2f

'main entry
function main()
local v0:= new Vec2f( 10,20 )
local v1:= new Vec2f( 30,40 )
print v0 + v1
end

0 comments on commit 41e1e81

Please # to comment.