require:只加载一次,后面不会执行
dofile:每一次文件都会执行
loadfile:载入后不执行,等你需要的时候执行时
local HaosModel = {} local function getname() return "Hao Chen" end function HaosModel.Greeting() print("Hello, My name is "..getname()) endlocal hao_model = require("mymod") hao_model.Greeting()