test.lua

1 function fact(n)
2 if n==0 then
3 return 1
4 else
5 return n*fact(n-1)
6 end
7 end

定义一个fact method

hi.lua

1 dofile("test.lua")
2 n=fact(3)
3 print(n)

dofie加载 test.lua

获取fact方法

调用成功

Debug 输出...ok

相关文章:

  • 2022-12-23
  • 2021-08-20
  • 2021-08-27
  • 2022-12-23
  • 2021-06-27
  • 2022-02-15
  • 2022-12-23
猜你喜欢
  • 2021-09-03
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-31
  • 2021-06-11
相关资源
相似解决方案