mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 00:30:02 +00:00
Add "mod" function for modulo in templating
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
b0d9b5782f
commit
bf9ec094bf
1 changed files with 2 additions and 0 deletions
|
@ -9,6 +9,7 @@ import (
|
||||||
func Register(args plugins.RegistrationArguments) error {
|
func Register(args plugins.RegistrationArguments) error {
|
||||||
args.RegisterTemplateFunction("add", plugins.GenericTemplateFunctionGetter(add))
|
args.RegisterTemplateFunction("add", plugins.GenericTemplateFunctionGetter(add))
|
||||||
args.RegisterTemplateFunction("div", plugins.GenericTemplateFunctionGetter(div))
|
args.RegisterTemplateFunction("div", plugins.GenericTemplateFunctionGetter(div))
|
||||||
|
args.RegisterTemplateFunction("mod", plugins.GenericTemplateFunctionGetter(mod))
|
||||||
args.RegisterTemplateFunction("mul", plugins.GenericTemplateFunctionGetter(mul))
|
args.RegisterTemplateFunction("mul", plugins.GenericTemplateFunctionGetter(mul))
|
||||||
args.RegisterTemplateFunction("multiply", plugins.GenericTemplateFunctionGetter(mul)) // DEPRECATED
|
args.RegisterTemplateFunction("multiply", plugins.GenericTemplateFunctionGetter(mul)) // DEPRECATED
|
||||||
args.RegisterTemplateFunction("pow", plugins.GenericTemplateFunctionGetter(math.Pow))
|
args.RegisterTemplateFunction("pow", plugins.GenericTemplateFunctionGetter(math.Pow))
|
||||||
|
@ -18,5 +19,6 @@ func Register(args plugins.RegistrationArguments) error {
|
||||||
|
|
||||||
func add(m1, m2 float64) float64 { return m1 + m2 }
|
func add(m1, m2 float64) float64 { return m1 + m2 }
|
||||||
func div(m1, m2 float64) float64 { return m1 / m2 }
|
func div(m1, m2 float64) float64 { return m1 / m2 }
|
||||||
|
func mod(m1, m2 int64) int64 { return m1 % m2 }
|
||||||
func mul(m1, m2 float64) float64 { return m1 * m2 }
|
func mul(m1, m2 float64) float64 { return m1 * m2 }
|
||||||
func sub(m1, m2 float64) float64 { return m1 - m2 }
|
func sub(m1, m2 float64) float64 { return m1 - m2 }
|
||||||
|
|
Loading…
Reference in a new issue