Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
test3
local health = 55 local maxHP = 100 local hp_diff = (maxHP - health) local reps = math.max(1, math.floor(hp_diff / 10)) local inc_hp = math.ceil(hp_diff / reps) print(reps, inc_hp) for k = 1, reps do if (health > maxHP) then break end health = math.min(maxHP, health + inc_hp) end print(health)
run
|
edit
|
history
|
help
-1
Please
log in
to post a comment.
test
Monty Hall Problem Simulated
char2int & int2char encoding
help with lua number input
5+5 == 10
Hand positions in a circle
Fixed
Lua recursion with function
Find primes until e
Replace all substring in string
Please log in to post a comment.