Пример #1
0
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
// 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
}