Lua load order

I’ve been wondering this for a long time now: in what order are Lua files loaded? I mean the Lua files in addons/*/lua/autorun/, the ones in lua/autorun/, the ones in lua/includes/extensions/, etc. What do pure-Lua libraries do to make sure that they are available when they are required?

Pretty sure it’s in this order.

Lua core files - standard ones (math , string and such)
Lua/includes/enum
Lua/includes/extensions
Lua/autorun/client or server
Lua/autorun/

99% sure enum goes before core files.

For the files in one directory (take lua/includes/enum for example), are those files loaded in a predictable order? Or does it just depend on the order that the OS returns the list of files in?

From what I’ve seen, there’s no specific order. Could be wrong though.

I did a feckton of tests to find this out at one point and can’t find my results.
What I can remember though is that you do get this order:

lua/autorun
lua/autorun/server|client
addons/lua/autorun
addons/lua/autorun/server|client
gamemode/

Thanks for the replies.

Do client Lua files load before server Lua files?

Yes

[lua]
Network: IP 192.168.1.100, mode MP, dedicated Yes, ports 27000 SV / 27005 CL
Unknown command “sv_rollangle”
Unknown command “sv_unlag_fixstuck”
L 04/27/2010 - 02:22:12: -------- Mapchange to gm_construct --------
loaded enum
Lua initialized (Lua 5.1)
loaded extensions
loaded autorun
loaded autorun/server
Registering gamemode ‘sandbox’ derived from ‘base’
[/lua]