示例#1
0
文件: ui.go 项目: kdar/morphgen
func LonBonusChange(L *lua.State) int {
	v := luar.CopyTableToMap(L, nil, 1).(map[string]interface{})

	buffer := &bytes.Buffer{}

	generator.Bonus(bonusTextValue(v["text"].(string)))
	generator.Output(buffer)

	args := []interface{}{buffer.String(), nil}
	addCallback(L, "onBonusChange_callback", args)
	return 0
}
示例#2
0
文件: ui.go 项目: kdar/morphgen
// A lua function wrapper to Generate().
func Lgenerate(L *lua.State) int {
	v := luar.CopyTableToMap(L, nil, 1).(map[string]interface{})
	v["bonus"] = bonusTextValue(v["bonustext"].(string))

	go func() {
		buffer := &bytes.Buffer{}
		err := generator.Generate(v, buffer)

		args := []interface{}{buffer.String(), err}
		addCallback(L, "generate_callback", args)
	}()
	return 0
}