hello_luatos.lua 792 B

123456789101112131415161718192021222324252627282930
  1. --[[
  2. @module hello_luatos
  3. @summary hello_luatos应用功能模块
  4. @version 1.0
  5. @date 2025.07.19
  6. @author 朱天华
  7. @usage
  8. 本文件为hello_luatos应用功能模块,核心业务逻辑为:
  9. 1、创建一个task;
  10. 2、在task的任务处理函数中,每隔一秒钟通过日志输出一次Hello, LuatOS;
  11. 本文件没有对外接口,直接在main.lua中require "hello_luatos"就可以加载运行;
  12. ]]
  13. -- hello_luatos的任务处理函数
  14. local function hello_luatos_task_func()
  15. while true do
  16. -- 输出日志 Hello, LuatOS
  17. log.info("Hello, LuatOS")
  18. -- 延时1000毫秒
  19. sys.wait(1000)
  20. end
  21. end
  22. -- 创建并且启动一个task
  23. -- 运行这个task的处理函数hello_luatos_task_func
  24. sys.taskInit(hello_luatos_task_func)