🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Untitled

posted in DruinkJournal
Published April 27, 2007
Advertisement
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...
Previous Entry Untitled
Next Entry Untitled
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement