Start typing to search packages!
lootset
By @meowtsun
Roblox
MirroredLootSet 1.0.0
LootSet is an immutable loot container built around table-based configurations rather than raw objects
Installation
Creator Store
you can get the module directly from Creator Store
Releases
if you need specific versions you can look into releases
Wally
you can install using Wally meowtsun/lootset@1.0.0
Overview
-- StoneDepositConfig.lua
local LootSet = require(...)
return LootSet.new({
Wood = LootSet.loot(50, {
DisplayName = "Wood",
SellPrice = 1,
StackSize = 99,
}),
Iron = LootSet.loot(15, {
DisplayName = "Iron Ingot",
SellPrice = 5,
StackSize = 99,
}),
Diamond = LootSet.loot(3, {
DisplayName = "Diamond",
SellPrice = 25,
StackSize = 10,
}),
})
-- other scripts
local config = require("StoneDepositConfig.lua")
local asPercentage = true
print(config.Iron.DisplayName) -- Iron Ingot
print(config:GetWeightOf('Iron', asPercentage) -- ~22.06
-- usable as config
local luck = 0
local item = config:Roll(luck)
print(item)
print(item.DisplayName)
print(item.StackSize)
-- usable as lootbag, luck & attempts supported
local amount, luck = 300, 20
config:Sample('High Luck Test', amount, luck)
-- sampling for testing
APIs
LootSet.new(config: t) -> (LootSet & t) - give back LootSet object
LootSet.loot(weight: number, item: a) -> a - for assigning loot
LootSet:Roll(luck: number?, attempts: number?) -> a - get random item, luck and attempts can be provided
LootSet:Sample(name: string, amount: number, luck: number?, attempts: number?) -> () - sample results, prints in output
LootSet:GetWeightOf(name: string, usePercentage: boolean?) -> (number) - get weight of an item, use assigned index
ListWeights: (self: LootSet, usePercentage: boolean?) -> {{Weight: number,Item: any}} - get entire array of items and their weight
Package Details
Install command (Click to copy)
Version
1.0.0
License
MIT
Safe for commercial use
Automated license review — not legal advice.
