Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

两个lua同时引用第三个lua文件,游戏结束后闪退 #137

Open
HiddenTesla opened this issue Jul 9, 2018 · 0 comments
Open

Comments

@HiddenTesla
Copy link

为了代码复用,将一些公共的东西放到某个文件中。
alice和bob都引用了mallory。
游戏几乎一定会在结束时弹出总结的时候挂掉。

以下是示例代码:

mallory.lua:

mallory = {}
mallory.hidden = true

mallory.marv = sgs.CreateTriggerSkill {
    name = "marv",
    frequency = sgs.Skill_NotFrequent,
    events = {sgs.DamageCaused},
    on_trigger = function(self, event, player, data)
        return false
    end
}
return mallory

alice.lua:

module("extensions.alice", package.seeall)
extension = sgs.Package("alice")

local mallory = require("extensions/mallory")

alice=sgs.General(extension, "alice","wei", 5, false)

bob.lua:

module("extensions.bob", package.seeall)
extension = sgs.Package("bob")

local mallory = require("extensions/mallory")

bob=sgs.General(extension, "bob","wei", 4, true)

bob:addSkill(mallory.marv)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant