Documentation
¶
Overview ¶
Package modinfo has been designed to interpretate modinfo.lua and give access to the supported values.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InterfaceToString ¶
func InterfaceToString(value interface{}) string
InterfaceToString returns a string representation of the provided interface.
Types ¶
type ConfigurationOptions ¶
type ConfigurationOptions struct {
// Values holds a list of all existing options.
Values []Option
}
ConfigurationOptions represents "configuration_options" in modinfo.lua.
func NewConfigurationOptions ¶
func NewConfigurationOptions() *ConfigurationOptions
NewConfigurationOptions creates a new ConfigurationOptions instance.
type Controller ¶
Controller is the interface that wraps the ModInfo methods.
type Field ¶
type Field struct {
// Name is the original global name like "name", "description", "api_version",
// etc.
Name string
// Description is the global description in a human-friendly format. It could
// be used to describe what the global does in a short form.
Description string
// Value holds the original global value.
Value interface{}
// IsRequired marks whether the global is required to be in modinfo.lua.
IsRequired bool
}
Field represents a single global in modinfo.lua.
type ModInfo ¶
type ModInfo struct {
// General holds a map of all general fields. It includes all the required
// ones except compatibility ones.
General map[string]*Field
// Compatibility holds a map of all required compatibility fields.
Compatibility map[string]*Field
// ConfigurationOptions holds "configuration_options".
ConfigurationOptions *ConfigurationOptions
// Other holds all other fields that are not required.
Other map[string]*Field
// contains filtered or unexported fields
}
ModInfo represents modinfo.lua data.
func (*ModInfo) FieldByName ¶
FieldByName returns a single Field based on its original global name.
func (*ModInfo) FieldsByName ¶
FieldsByName returns multiple Field structs based on the provided global names.
type Option ¶
type Option struct {
// Label is the original label value.
//
// configuration_options.<option>.label
Label string
// Name is the original name value.
//
// configuration_options.<option>.name
Name string
// Default is the original default value.
//
// configuration_options.<option>.default
Default *OptionDefault
// Default is the original hover value.
//
// configuration_options.<option>.hover
Hover string
}
Option represents a single option for "configuration_options" in modinfo.lua.
type OptionDefault ¶
type OptionDefault struct {
// Description is the original description value.
//
// configuration_options.<option>.default.description
Description string
// Description is the original data value.
//
// configuration_options.<option>.default.data
Data interface{}
}
OptionDefault represents an option default value.
func (*OptionDefault) DataString ¶
func (c *OptionDefault) DataString() string
DataString returns a string representation of an OptionDefault data.
func (*OptionDefault) String ¶
func (c *OptionDefault) String() string
String returns a string representation of a OptionDefault value which is its description.