General > Developers Corner

My first Lua library/API/thing! (From another Lua half-noob)

<< < (2/3) > >>

Megiddo:
Oh, I didn't even notice that. You shouldn't change the seed except at initialization (which Garry already does). That's probably why you're getting poor results. Every time you reset the seed in the same second, you're going to get the same number back.

Bytewave:

--- Quote from: Megiddo on January 26, 2014, 04:47:10 PM ---Oh, I didn't even notice that. You shouldn't change the seed except at initialization (which Garry already does). That's probably why you're getting poor results. Every time you reset the seed in the same second, you're going to get the same number back.

--- End quote ---
Which is why I dump the first five random values into a table that i then clear. :P

EDIT: Also, i wrote this for Lua period, not necessarily just GLua, hence there not being any GLua code... I'm still learning basic Lua syntax before i move on to something like GLua. :P

JamminR:

--- Quote from: Princess Twilight Sparkle on January 26, 2014, 05:12:17 PM ---hence there not being any GLua code

--- End quote ---
ULib = 99.9% glua free.
.01%, I think, due to hacks we've fixed for Glua

MrPresident:
Yeah, you shouldn't graduate from lua to glua. If you can avoid using glua do so.

All glua adds are helper functions to make your life easier at the expense of learning lua wrong.

For instance, lua does not have a lot of the same string library functions that glua has. If you want string.explode you have to code that yourself, the hard way.

Bytewave:
But what about functions that CAN'T be coded yourself? What about functions that execute code in Source itself, or something like AddConVar() (pretty sure that's the one) and AddConsoleCommand() that call code outside of Lua?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version