#### Function table

section data
footext:
string "foo called with n = %d\n\x00"
bartext:
string "bar called with n = %d\n\x00"
baztext:
string "baz called with n = %d\n\x00"

vtable:
word foo
word bar
word baz

section functions
import printf
export main

main:
function argc argv
  call testloop 2
  return 0
end function

testloop:
function n
  let func get-word vtable n
  call func n
  ifeq n 0
    return 0
  else
    set n sub n 1
    tail-call testloop n
  end if
end function

foo:
function n
  call printf footext n
  return 0
end function

bar:
function n
  call printf bartext n
  return 0
end function

baz:
function n
  call printf baztext n
  return 0
end function
