lang: funcs: core: Make module names public
This is needed for when we have nested modules.
This commit is contained in:
@@ -26,7 +26,7 @@ import (
|
||||
const Answer = 42
|
||||
|
||||
func init() {
|
||||
simple.ModuleRegister(moduleName, "answer", &types.FuncValue{
|
||||
simple.ModuleRegister(ModuleName, "answer", &types.FuncValue{
|
||||
T: types.NewType("func() int"),
|
||||
V: func([]types.Value) (types.Value, error) {
|
||||
return &types.IntValue{V: Answer}, nil
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
simple.ModuleRegister(moduleName, "errorbool", &types.FuncValue{
|
||||
simple.ModuleRegister(ModuleName, "errorbool", &types.FuncValue{
|
||||
T: types.NewType("func(a bool) str"),
|
||||
V: func(input []types.Value) (types.Value, error) {
|
||||
if input[0].Bool() {
|
||||
|
||||
@@ -18,6 +18,6 @@
|
||||
package coreexample
|
||||
|
||||
const (
|
||||
// moduleName is the prefix given to all the functions in this module.
|
||||
moduleName = "example"
|
||||
// ModuleName is the prefix given to all the functions in this module.
|
||||
ModuleName = "example"
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
facts.ModuleRegister(moduleName, "flipflop", func() facts.Fact { return &FlipFlopFact{} }) // must register the fact and name
|
||||
facts.ModuleRegister(ModuleName, "flipflop", func() facts.Fact { return &FlipFlopFact{} }) // must register the fact and name
|
||||
}
|
||||
|
||||
// FlipFlopFact is a fact which flips a bool repeatedly. This is an example fact
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
simple.ModuleRegister(moduleName, "int2str", &types.FuncValue{
|
||||
simple.ModuleRegister(ModuleName, "int2str", &types.FuncValue{
|
||||
T: types.NewType("func(a int) str"),
|
||||
V: func(input []types.Value) (types.Value, error) {
|
||||
return &types.StrValue{
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
simple.ModuleRegister(moduleName, "str2int", &types.FuncValue{
|
||||
simple.ModuleRegister(ModuleName, "str2int", &types.FuncValue{
|
||||
T: types.NewType("func(a str) int"),
|
||||
V: func(input []types.Value) (types.Value, error) {
|
||||
var i int64
|
||||
|
||||
@@ -33,7 +33,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
funcs.ModuleRegister(moduleName, "vumeter", func() interfaces.Func { return &VUMeterFunc{} }) // must register the func and name
|
||||
funcs.ModuleRegister(ModuleName, "vumeter", func() interfaces.Func { return &VUMeterFunc{} }) // must register the func and name
|
||||
}
|
||||
|
||||
// VUMeterFunc is a gimmic function to display a vu meter from the microphone.
|
||||
|
||||
Reference in New Issue
Block a user