dofile工作但是调用栈回溯

main.lua

dofile("example.lua")

example.lua

print "Hello World"

结果是:

Hello World
lua: main.lua:1: attempt to call a nil value
stack traceback:
    main.lua:1: in main chunk
    [C]: in ?

但是我不明白为什么?

点赞