Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    557
  • comments
    1237
  • views
    422935

Untitled

Sign in to follow this  
Evil Steve

54 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...
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!