lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


You should properly use tables for name spaces. So each script has its own namespace (table)... Something like

user.action()
enemy.action()

etc....

/Erik

Enno Rehling wrote:

I am loading a bunch of user-scripts from a list of files, and I'm wondering how to keep them from messing with each other. If I have two scripts defining the same identifier in the globals table (like two functions called action(), or two variables called size), One of those scripts is going to puke.

I suppose there's no easy way to do this, other than run each in its own lua_state, but I'm just going to ignore my intuition and ask anyway: How do others solve this?

Enno.