General > Developers Corner
Always round numbers
Reese:
Hello guys,
I would like to know if ULib.cmds.NumArg could be 0.5 (like not rounded)
Here's the code :
cmd = ULib.cmds.TranslateCommand( "ugm slap", ULib.slap )
cmd:addParam{ type=ULib.cmds.PlayerArg, target="*", default="^", ULib.cmds.optional }
cmd:addParam{ type=ULib.cmds.NumArg, min=0, default=0, ULib.cmds.optional }
It is always 0 for 0.4 and always 1 for 0.5 !
Thank you guys
Bytewave:
From the docs, it doesn't look like it usually rounds. Maybe this is a bug?
Can you try your command with 1.5? Or anything >1?
Maybe also try .5 instead of 0.5? I would doubt that's the issue, but I don't know.
Reese:
Still rounds up man
Megiddo:
I will need to double check, but it should not be rounding. Are you rounding in the destination function?
Bytewave:
Wait, I just noticed. OP, that code doesn't look like code you'd be using to write a command of your own. If it is, that doesn't look correct.
Please post the entirety of the code you're using to test using [code=lua][/code] to surround it.
Also, Meg, it doesn't seem to unless it's cut off before parsing: https://github.com/TeamUlysses/ulib/blob/master/lua/ulib/shared/commands.lua#L254
Navigation
[0] Message Index
[#] Next page
Go to full version