Ramirow
Veteran OT User
- Joined
- Aug 22, 2009
- Messages
- 584
- Solutions
- 15
- Reaction score
- 301
- Location
- Argentina
- YouTube
- ramirogrant
Guys, im running into an issue, I will leave an example below, and the error code I get, I can't seem to work out WHY it's receiving a nil value, if I print the value of that var before the math.random() function everything looks good, its for sure not a Nil value.
Using TFS 1.2
It returns this:
Using TFS 1.2
Code:
local crystals = {
[18420] = { -- Red Crystal config table
itemid = 18420,
itemCraftWood1NormalAmount = 7, --Loop items for normal craft
itemCraftWood1BonusAmount = 4, --Loop items for bonus craft
level = {min = 20, success = 15},
materials = {wood = 3873, steel = 5887},
materialRemovalWood = 5,
materialRemovalSteel = 5,
skillSuccessIncrement = 1,
refine = 1,
xp = 3
}
}
local luckItem = math.floor(math.random(1, crystals[target.itemid].itemCraftWood1BonusAmount))
It returns this:
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/other/smithing.lua:onUse
data/actions/scripts/other/smithing.lua:196: bad argument #2 to 'random' (number expected, got nil)
stack traceback:
[C]: at 0x7ff7a2212ef0
[C]: in function 'random'
data/actions/scripts/other/smithing.lua:196: in function <data/actions/scripts/other/smithing.lua:59>