private static int OpenCamera(IntPtr L) { int result; try { ToLua.CheckArgsCount(L, 2); PlatformUtil platformUtil = (PlatformUtil)ToLua.CheckObject(L, 1, typeof(PlatformUtil)); LuaTypes luaTypes = LuaDLL.lua_type(L, 2); Action <string> completeCallback; if (luaTypes != LuaTypes.LUA_TFUNCTION) { completeCallback = (Action <string>)ToLua.CheckObject(L, 2, typeof(Action <string>)); } else { LuaFunction func = ToLua.ToLuaFunction(L, 2); completeCallback = (DelegateFactory.CreateDelegate(typeof(Action <string>), func) as Action <string>); } platformUtil.OpenCamera(completeCallback); result = 0; } catch (Exception e) { result = LuaDLL.toluaL_exception(L, e, null); } return(result); }