我正在尝试弄清楚如何在我的代码中使用方法,这让我非常困惑 我尝试使用以下代码: string.testfunc = function(s) print(s) enda:testfuncno matter the type of the varible
>method 'testfunc' is not callable (a nil value) 为什么我可以在字符串表中创建一个方法
显然,我有些混淆了,但我在“main.lua”中使用了这样的东西:local var = "I should be global?"printthis()function printthis()end
printthis(var)可以正常工作,因为现在module.lua代码在main.lua中,不是吗?我读到在可能的情况下在<e