• entries
557
1237
• views
421605

# Untitled

45 views

I've been moving my code more and more into Lua. Instead of having the main user loop in C++ and call Lua functions to check usernames, and so on, I now call a script "Tick" function once for each user. More scriptability = good.

I also found out that I'm using a 4 year old version of Lua (v5.0), which is missing some rather useful functions - like the ability to convert a string to a number. The following code gives me an error:
function HandleNewUser(user)   ip = GetConnectionIP(user);   expires = GetDBValue("ipbans", ip)   if expires ~= "" then      if expires <= GetTime() then         SetDBValue("ipbans", ip, "");      else   -- Snip

Saying that it can't compare a string to a number (GetTime() returns a number, expires is a string). Apparently the tonumber() function doesn't exist in v5.0 unless it's a debug build (wtf?). strlen() doesn't exist either.

So I'll be getting and compiling Lua 5.1 this lunch time...

There are no comments to display.

## Create an account

Register a new account