public static void OpenLibs(IntPtr L)
{
LuaDLL.lua_getglobal(L, "tolua");
LuaDLL.lua_pushstring(L, "findtype");
LuaDLL.lua_pushcfunction(L, new LuaCSFunction(LuaReflection.FindType));
LuaDLL.lua_rawset(L, -3);
LuaDLL.lua_pushstring(L, "loadassembly");
LuaDLL.tolua_pushcfunction(L, new LuaCSFunction(LuaReflection.LoadAssembly));
LuaDLL.lua_rawset(L, -3);
LuaDLL.lua_pushstring(L, "getmethod");
LuaDLL.tolua_pushcfunction(L, new LuaCSFunction(LuaReflection.GetMethod));
LuaDLL.lua_rawset(L, -3);
LuaDLL.lua_pushstring(L, "getconstructor");
LuaDLL.tolua_pushcfunction(L, new LuaCSFunction(LuaReflection.GetConstructor));
LuaDLL.lua_rawset(L, -3);
LuaDLL.lua_pushstring(L, "gettypemethod");
LuaDLL.tolua_pushcfunction(L, new LuaCSFunction(LuaReflection.GetTypeMethod));
LuaDLL.lua_rawset(L, -3);
LuaDLL.lua_pushstring(L, "getfield");
LuaDLL.tolua_pushcfunction(L, new LuaCSFunction(LuaReflection.GetField));
LuaDLL.lua_rawset(L, -3);
LuaDLL.lua_pushstring(L, "getproperty");
LuaDLL.tolua_pushcfunction(L, new LuaCSFunction(LuaReflection.GetProperty));
LuaDLL.lua_rawset(L, -3);
LuaDLL.lua_pushstring(L, "createinstance");
LuaDLL.tolua_pushcfunction(L, new LuaCSFunction(LuaReflection.CreateInstance));
LuaDLL.lua_rawset(L, -3);
LuaDLL.lua_pop(L, 1);
LuaState luaState = LuaState.Get(L);
luaState.BeginPreLoad();
luaState.AddPreLoad("tolua.reflection", new LuaCSFunction(LuaReflection.OpenReflectionLibs));
luaState.EndPreLoad();
}