Function calling in structs

This commit is contained in:
2025-09-20 20:23:57 +10:00
parent 93eec33e60
commit d7b0c4d818
2 changed files with 77 additions and 26 deletions

View File

@@ -2,23 +2,28 @@ struct -point
init &xpos -int
init &ypos -int
fun -void !init -int &x -int &y
fun -int !init -int &x -int &y
set &xpos $x
set &ypos $y
return
return 0
endfun
fun -string !toString
# do stuff
return "placeholder"
endfun
fun -int !dingle
return 23
tostring $xpos &xposstr
tostring $ypos &yposstr
add "x: " $xposstr &str
add $str ", y: " &str
add $str $yposstr &str
return $str
endfun
endstruct
init &myPoint -point
set &myPoint.xpos 20
pusharg 30 15
!myPoint.init &out
println $myPoint.xpos
!myPoint.toString &out
println $out