Documentation ¶
Index ¶
- Constants
- func Capitalize(str string) string
- func ClampInt(v, min, max int) int
- func Contains[T comparable](s []T, v T) bool
- func FindFilePathsWithExtension(root, ext string) []string
- func FindIndex[T comparable](s []T, v T) int
- func GetLuaFunctionFromTable(tbl *lua.LTable, fnName string) *lua.LFunction
- func Keys[TKey comparable, TValue any](m map[TKey]TValue) []TKey
- func LineBreak(str string, maxLen int, delimiter string) []string
- func LoadFileBytes(path string) ([]byte, error)
- func MaxInt(a, b int) int
- func MinInt(a, b int) int
- func RandChance100() float64
- func RandRange(min int, max int) int
- func SnakeFriendlyTitle(str string) string
- func SwapDelete[T any](s []T, idx int) []T
- func ToUserData(L *lua.LState, val interface{}) *lua.LUserData
- func ToUserDataList[T any](L *lua.LState, arr []T) *lua.LTable
- func Values[TKey comparable, TValue any](m map[TKey]TValue) []TValue
- func WrapLuaFunc(L *lua.LState, val lua.LValue) func()
- type ChanceTable
- type ChanceTableEntry
- type List
- type Node
- type Seconds
- type StringBuilder
- func (sb *StringBuilder) Len() int
- func (sb *StringBuilder) Reset()
- func (sb *StringBuilder) String() string
- func (sb *StringBuilder) WriteHorizontalDivider() *StringBuilder
- func (sb *StringBuilder) WriteLine(s string) *StringBuilder
- func (sb *StringBuilder) WriteLinef(format string, a ...any) *StringBuilder
- func (sb *StringBuilder) WriteNewLine() *StringBuilder
- func (sb *StringBuilder) WriteString(s string) *StringBuilder
- func (sb *StringBuilder) WriteStringf(format string, a ...any) *StringBuilder
- type StringMapping
- type WeightedTable
- type WeightedTableConfig
- type WeightedTableEntry
Constants ¶
View Source
const HorizontalDivider = "---------------------------------"
View Source
const NewLine = "\n\r"
Variables ¶
This section is empty.
Functions ¶
func Capitalize ¶
func Contains ¶
func Contains[T comparable](s []T, v T) bool
func FindIndex ¶
func FindIndex[T comparable](s []T, v T) int
func GetLuaFunctionFromTable ¶
func Keys ¶
func Keys[TKey comparable, TValue any](m map[TKey]TValue) []TKey
func LoadFileBytes ¶
func RandChance100 ¶
func RandChance100() float64
func SnakeFriendlyTitle ¶
func SwapDelete ¶
func Values ¶
func Values[TKey comparable, TValue any](m map[TKey]TValue) []TValue
Types ¶
type ChanceTable ¶
type ChanceTable[T any] []*ChanceTableEntry[T]
func (*ChanceTable[T]) Select ¶
func (t *ChanceTable[T]) Select() []T
func (*ChanceTable[T]) SelectMultiplied ¶
func (t *ChanceTable[T]) SelectMultiplied(mult float64) []T
type ChanceTableEntry ¶
type List ¶
type List[T comparable] struct { Head *Node[T] Tail *Node[T] }
type StringBuilder ¶
type StringBuilder struct { NewLine string // contains filtered or unexported fields }
func (*StringBuilder) Len ¶
func (sb *StringBuilder) Len() int
func (*StringBuilder) Reset ¶
func (sb *StringBuilder) Reset()
func (*StringBuilder) String ¶
func (sb *StringBuilder) String() string
func (*StringBuilder) WriteHorizontalDivider ¶
func (sb *StringBuilder) WriteHorizontalDivider() *StringBuilder
func (*StringBuilder) WriteLine ¶
func (sb *StringBuilder) WriteLine(s string) *StringBuilder
func (*StringBuilder) WriteLinef ¶
func (sb *StringBuilder) WriteLinef(format string, a ...any) *StringBuilder
func (*StringBuilder) WriteNewLine ¶
func (sb *StringBuilder) WriteNewLine() *StringBuilder
func (*StringBuilder) WriteString ¶
func (sb *StringBuilder) WriteString(s string) *StringBuilder
func (*StringBuilder) WriteStringf ¶
func (sb *StringBuilder) WriteStringf(format string, a ...any) *StringBuilder
type StringMapping ¶
type StringMapping[T comparable] struct { ToValue map[string]T ToString map[T]string }
func NewStringMapping ¶
func NewStringMapping[T comparable](mapping map[T]string) *StringMapping[T]
type WeightedTable ¶
type WeightedTable[T any] struct { // contains filtered or unexported fields }
func NewWeightedTable ¶
func NewWeightedTable[T any](cfg WeightedTableConfig[T]) *WeightedTable[T]
func (*WeightedTable[T]) Select ¶
func (t *WeightedTable[T]) Select() T
type WeightedTableConfig ¶
type WeightedTableConfig[T any] []*WeightedTableEntry[T]
type WeightedTableEntry ¶
Click to show internal directories.
Click to hide internal directories.