Index: branches/script_engine/src/lib/script_engine/account.cc
===================================================================
--- branches/script_engine/src/lib/script_engine/account.cc	(revision 8396)
+++ branches/script_engine/src/lib/script_engine/account.cc	(revision 8397)
@@ -14,5 +14,5 @@
       lua_Number m_balance;
    public:
-     static const char className[];
+    // static const char className[];
      static Lunar<Account>::RegType methods[];
 
@@ -30,5 +30,5 @@
  };
 
- const char Account::className[] = "Account";
+ //const char Account::className[] = "Account";
 
  Lunar<Account>::RegType Account::methods[] = {
@@ -39,4 +39,6 @@
  };
 
- CREATE_SCRIPTABLE_CLASS(Account, CL_ACCOUNT, ScriptMethod("deposit", ExecutorLua1<Account, float>(&Account::deposit)));
+tScriptClass<Account> global_ACCOUNT_ScriptableClass("Account", CL_ACCOUNT, NULL);
 
+
+//CREATE_SCRIPTABLE_CLASS(Account, CL_ACCOUNT, NULL);
Index: branches/script_engine/src/lib/script_engine/lunar.h
===================================================================
--- branches/script_engine/src/lib/script_engine/lunar.h	(revision 8396)
+++ branches/script_engine/src/lib/script_engine/lunar.h	(revision 8397)
@@ -21,16 +21,17 @@
 
 
-  static void Register(Script* script)
+  static void Register(Script* script, const std::string& className)
   {
     if(script != NULL)
-      Register(script->getLuaState());
-  }
-
-  static void Register(lua_State *L)
-  {
+      Register(script->getLuaState(), className);
+  }
+
+  static void Register(lua_State *L, const std::string& className)
+  {
+    Lunar<T>::className = className;
     lua_newtable(L);
     int methods = lua_gettop(L);
 
-    luaL_newmetatable(L, T::className);
+    luaL_newmetatable(L, Lunar<T>::className.c_str());
     int metatable = lua_gettop(L);
 
@@ -38,5 +39,5 @@
     // scripts can add functions written in Lua.
     lua_pushvalue(L, methods);
-    set(L, LUA_GLOBALSINDEX, T::className);
+    set(L, LUA_GLOBALSINDEX, Lunar<T>::className.c_str());
 
     // hide metatable from Lua getmetatable()
@@ -77,8 +78,8 @@
   {
     int base = lua_gettop(L) - nargs;  // userdata index
-    if (!luaL_checkudata(L, base, T::className))
+    if (!luaL_checkudata(L, base, Lunar<T>::className.c_str()))
     {
       lua_settop(L, base-1);           // drop userdata and args
-      lua_pushfstring(L, "not a valid %s userdata", T::className);
+      lua_pushfstring(L, "not a valid %s userdata", Lunar<T>::className.c_str());
       return -1;
     }
@@ -89,5 +90,5 @@
     {            // no method?
       lua_settop(L, base-1);           // drop userdata and args
-      lua_pushfstring(L, "%s missing method '%s'", T::className, method);
+      lua_pushfstring(L, "%s missing method '%s'", Lunar<T>::className.c_str(), method);
       return -1;
     }
@@ -100,5 +101,5 @@
       if (msg == NULL) msg = "(error with no message)";
       lua_pushfstring(L, "%s:%s status = %d\n%s",
-                      T::className, method, status, msg);
+                      Lunar<T>::className.c_str(), method, status, msg);
       lua_remove(L, base);             // remove old message
       return -1;
@@ -111,6 +112,6 @@
   {
     if (!obj) { lua_pushnil(L); return 0; }
-    luaL_getmetatable(L, T::className);  // lookup metatable in Lua registry
-    if (lua_isnil(L, -1)) luaL_error(L, "%s missing metatable", T::className);
+    luaL_getmetatable(L, Lunar<T>::className.c_str());  // lookup metatable in Lua registry
+    if (lua_isnil(L, -1)) luaL_error(L, "%s missing metatable", Lunar<T>::className.c_str());
     int mt = lua_gettop(L);
     subtable(L, mt, "userdata", "v");
@@ -160,6 +161,6 @@
   {
     userdataType *ud =
-      static_cast<userdataType*>(luaL_checkudata(L, narg, T::className));
-    if(!ud) luaL_typerror(L, narg, T::className);
+      static_cast<userdataType*>(luaL_checkudata(L, narg, Lunar<T>::className.c_str()));
+    if(!ud) luaL_typerror(L, narg, Lunar<T>::className.c_str());
     return ud->pT;  // pointer to T object
   }
@@ -212,5 +213,5 @@
     T *obj = ud->pT;
     sprintf(buff, "%p", obj);
-    lua_pushfstring(L, "%s (%s)", T::className, buff);
+    lua_pushfstring(L, "%s (%s)", Lunar<T>::className.c_str(), buff);
     return 1;
   }
@@ -264,6 +265,12 @@
     return ud;
   }
+
+  private:
+    static std::string className;
 };
 
+template <typename T>
+    std::string Lunar<T>::className = "";
+
 #endif /* _LUNAR_H */
 
Index: branches/script_engine/src/lib/script_engine/script_class.h
===================================================================
--- branches/script_engine/src/lib/script_engine/script_class.h	(revision 8396)
+++ branches/script_engine/src/lib/script_engine/script_class.h	(revision 8397)
@@ -19,5 +19,5 @@
  */
 #define CREATE_SCRIPTABLE_CLASS(CLASS_NAME, CLASS_ID, SCRIPT_METHODS) \
-    tScriptable<CLASS_NAME> global_##CLASS_NAME##_ScriptableClass(#CLASS_NAME, CLASS_ID, new SCRIPT_METHODS)
+    tScriptClass<CLASS_NAME> global_##CLASS_NAME##_ScriptableClass(#CLASS_NAME, CLASS_ID, new SCRIPT_METHODS)
 
 
@@ -48,8 +48,8 @@
 
 template <class T>
-class tScriptable : public ScriptClass
+class tScriptClass : public ScriptClass
 {
 public:
-  tScriptable(const std::string& name, ClassID classID, ScriptMethod* scriptMethods)
+  tScriptClass(const std::string& name, ClassID classID, ScriptMethod* scriptMethods)
       : ScriptClass(name, classID, scriptMethods)
   { }
@@ -57,5 +57,5 @@
   virtual void registerClass(Script* script)
   {
-    Lunar<T>::Register(script);
+    Lunar<T>::Register(script, this->getName());
   }
   virtual int insertObject(Script* L, BaseObject* obj, bool gc=false)
