Scripting a Leveling System in Lua

Not sure if this is where to post this, but I am creating an 8-Bit RPG in Lua. I'm coding the whole thing from the beginning. Some of the things I have completed are as follows.

-Collision Detection
-Player, Mobs, Bosses
-Action Battles, Zelda Style

I'm having trouble with getting an extremely simple leveling system scripted in lua. I'm probably just over thinking it. I'm trying ro get it to make the main character to level when he hits x amount of exp and did so by checking if the current exp is greater than the exp needed to level, then add 1 to level, increase hp by 1.5 times, increase damage by 1, subtract the exp needed from the current exp, and multiply the exp needed by 1.5 times. I might be placing it in the wrong place or just doing it completely wrong altogether. Either way, any input is greatly appreciated.
This is an RPG Maker forum. RPG Makers use Ruby or Javascript.
I realize that. I use them all the time. I just figured maybe someone else who uses RPG Maker is also well versed in Lua. Not to mention that Lua and Ruby are extremely similar. Basically siblings.
@TreeGuy
The problem mentioned by Shaz is that this is the official, company owned forum for the RPG-Maker series and we do not support any other engine than the engines sold by Degica - after all, why should Degica pay for the servers to support programs they don't sell.

If you go to a fanforum of the RM-series, then you might get an answer - here it is against the rules to even ask for non-RM-support.

Moderator note: closing

Original thread: https://forums.rpgmakerweb.com/threads/scripting-a-leveling-system-in-lua.79305/